Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
fixed settings.ini paths
Browse files Browse the repository at this point in the history
  • Loading branch information
infeeeee committed Aug 6, 2019
1 parent 933c0ec commit 5bd0d81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions kimai2-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,8 @@ function uiAutocompleteSelect(thelist, message) {
function iniPath() {
//different settings.ini path for developement and pkg and windows installer version
const iniRoot = [
path.dirname(process.execPath),
__dirname
path.dirname(process.execPath),//This is for pkg version
__dirname//This is for npm version
]

if (appdata) { iniRoot.push(path.join(appdata, '/kimai2-cmd')) }
Expand Down Expand Up @@ -647,14 +647,22 @@ function uiAskForSettings() {
*/
function iniFullPath() {
let installDir = path.dirname(process.execPath).split("\\")
let dirArr = __dirname.split(path.sep)

//I should replace this tererible if to some registry value readin, maybe for uninstaller
//Maybe I should replace this terrible 'if' with some registry value reading
if (platform == 'win32' && installDir[installDir.length - 2] == "Program Files" && installDir[installDir.length - 1] == "kimai2-cmd") {
if (program.verbose) { console.log('This is an installer based windows installation') }
if (!fs.existsSync(path.join(appdata, 'kimai2-cmd'))) {
fs.mkdirSync(path.join(appdata, 'kimai2-cmd'))
}
return path.join(appdata, 'kimai2-cmd', 'settings.ini')
} else if (dirArr[0] == 'snapshot' || dirArr[1] == 'snapshot') {
if (program.verbose) {console.log('This is a pkg version')}
//for pkg version:
return path.join(path.dirname(process.execPath), 'settings.ini')
} else {
if (program.verbose) {console.log('This is an npm version')}
//For npm version:
return './settings.ini'
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kimai2-cmd",
"version": "0.2.4",
"version": "0.2.5",
"description": "Command line client for Kimai2",
"main": "kimai2-cmd.js",
"bin": {
Expand Down

0 comments on commit 5bd0d81

Please sign in to comment.