-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from ebkr/feature/275/custom-data-folder-loca…
…tion Feature/275/custom data folder location
- Loading branch information
Showing
8 changed files
with
69 additions
and
18 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
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
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
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
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
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 |
---|---|---|
@@ -1,20 +1,30 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs-extra'; | ||
import ManagerSettings from './ManagerSettings'; | ||
|
||
export default class PathResolver { | ||
|
||
private static _APPDATA_DIR: string = ''; | ||
private static _ROOT: string = ''; | ||
private static _MOD_ROOT: string = ''; | ||
|
||
static get ROOT(): string { | ||
return PathResolver._ROOT; | ||
static set APPDATA_DIR(appDataDir: string) { | ||
PathResolver._APPDATA_DIR = appDataDir; | ||
ManagerSettings.getSingleton().load(); | ||
PathResolver._ROOT = ManagerSettings.getSingleton().dataDirectory; | ||
fs.ensureDirSync(PathResolver._ROOT); | ||
PathResolver._MOD_ROOT = path.join(PathResolver._ROOT, 'mods'); | ||
} | ||
|
||
static set ROOT(root: string) { | ||
PathResolver._ROOT = root; | ||
PathResolver._MOD_ROOT = path.join(root, 'mods'); | ||
static get ROOT(): string { | ||
return PathResolver._ROOT; | ||
} | ||
|
||
static get MOD_ROOT(): string { | ||
return PathResolver._MOD_ROOT; | ||
} | ||
|
||
static get APPDATA_DIR(): string { | ||
return PathResolver._APPDATA_DIR; | ||
} | ||
} |
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
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