-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
12 changed files
with
148 additions
and
90 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { PathType } from 'model'; | ||
import api from 'renderer/Api'; | ||
import { platform, TT_APP_ID } from 'renderer/Constants'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export async function validateSettingsPath(field: string, value: string): Promise<string | undefined> { | ||
const result: string | undefined = await api | ||
.pathExists(value, field === 'gameExec' ? PathType.FILE : PathType.DIRECTORY) | ||
.then((success) => { | ||
if (!success) { | ||
return 'Provided path is invalid'; | ||
} | ||
switch (field) { | ||
case 'gameExec': | ||
if (value.toLowerCase().includes('terratech')) { | ||
if (platform === 'win32' && !value.endsWith('.exe')) { | ||
return 'Windows executables must end in .exe'; | ||
} | ||
return undefined; | ||
} | ||
return "The TerraTech executable should contain 'TerraTech'"; | ||
case 'localDir': | ||
if (!value || value.toLowerCase().endsWith('localmods')) { | ||
return undefined; | ||
} | ||
return "The local mods directory should end with 'TerraTech/LocalMods'"; | ||
case 'workshopDir': | ||
if (value.endsWith(TT_APP_ID)) { | ||
return undefined; | ||
} | ||
return `The workshop directory should end with TT app ID 'Steam/steamapps/workshop/content/${TT_APP_ID}'`; | ||
case 'logsDir': | ||
if (value.toLowerCase().includes('logs')) { | ||
return undefined; | ||
} | ||
return "The logs directory should contain 'Logs'"; | ||
default: | ||
return undefined; | ||
} | ||
}) | ||
.catch((error) => { | ||
return error.toString(); | ||
}); | ||
return result; | ||
} |
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,23 @@ | ||
{ | ||
"folders": [ | ||
{ | ||
"path": "." | ||
} | ||
], | ||
"settings": { | ||
"files.associations": { | ||
".eslintrc": "jsonc", | ||
".prettierrc": "jsonc", | ||
".eslintignore": "ignore" | ||
}, | ||
"javascript.validate.enable": false, | ||
"javascript.format.enable": false, | ||
"typescript.format.enable": false, | ||
"prettier.enable": true, | ||
"prettier.documentSelectors": [ | ||
"*.js", | ||
"*.ts", | ||
"*.tsx" | ||
] | ||
} | ||
} |