-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 374a69a
Showing
7 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin/ | ||
*.log | ||
skylinux.cfg | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-d:release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Package | ||
|
||
version = "1.0" | ||
author = "Christian Guetnga" | ||
description = "Skyrim Mod Manager for Linux nords" | ||
license = "MIT" | ||
srcDir = "src" | ||
binDir = "bin" | ||
bin = @["skylinux"] | ||
|
||
|
||
# Dependencies | ||
|
||
requires "nim >= 2.0.8" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import parsecfg | ||
import logging | ||
|
||
import constants | ||
|
||
type Config* = object | ||
gamePath*: string | ||
winePrefixPath*: string | ||
modsPath*: string | ||
modLoadOrderPath*: string | ||
|
||
proc createConfigFile(): Config = | ||
info("config file does not exists. Creating a new one") | ||
|
||
var dict = newConfig() | ||
result = Config() | ||
|
||
stdout.write("Enter game path: ") | ||
let gamePath = stdin.readLine() | ||
|
||
stdout.write("Enter .wine prefix path: ") | ||
let winePrefixPath = stdin.readLine() | ||
|
||
result.gamePath = gamePath | ||
result.winePrefixPath = winePrefixPath | ||
|
||
dict.setSectionKey("General", "game_path", gamePath) | ||
dict.setSectionKey("General", "wine_prefix_path", winePrefixPath) | ||
|
||
dict.writeConfig(cfgPath) | ||
|
||
proc loadConfigFile(): Config = | ||
let dict = loadConfig(cfgPath) | ||
result.gamePath = dict.getSectionValue("General", "game_path") | ||
result.winePrefixPath = dict.getSectionValue("General", "wine_prefix_path") | ||
|
||
proc getConfig*(): Config = | ||
if not fileExists(cfgPath): createConfigFile() else: loadConfigFile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const cfgPath* = "./skylinux.cfg" | ||
const logPath* = "./skylinux.log" | ||
const errLogPath* = "./skylinux_errors.log" | ||
|
||
const logFmtStr* = "[$time $date] - $levelname: " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import logging | ||
import constants | ||
|
||
proc loggerInit*() {.noreturn.} = | ||
addHandler newConsoleLogger(fmtStr=logFmtStr) | ||
addHandler newFileLogger(logPath, fmtStr=logFmtStr) | ||
addHandler newFileLogger(errLogPath, fmtStr=logFmtStr, levelThreshold=lvlError) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
import strformat | ||
|
||
import logger | ||
import config | ||
|
||
# Logger setup | ||
loggerInit() | ||
|
||
proc getMods(): seq[string] = | ||
@[] | ||
|
||
proc runGame(config: Config, withModes: bool = true) {.noreturn.} = | ||
discard execShellCmd(fmt"cd {config.gamePath} && wine skse_loader.exe") | ||
|
||
var cfg = getConfig() |