Skip to content

Commit

Permalink
fixes some path related issues, bump to 0.1.2 in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Picorims committed Jun 22, 2021
1 parent e23d3a0 commit fa907e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var current_settings_version = 1;
//settings initialization. Go reading the .json save.
async function InitSettings() {
CustomLog("info","initializing settings...");
let default_settings_path = `${working_dir}/user/settings/default_settings.json`;
let default_settings_path = "./user/settings/default_settings.json";
let user_settings_path = `${working_dir}/user/settings/user_settings.json`;

if (!await ipcRenderer.invoke("path-exists", user_settings_path)) {
Expand Down
16 changes: 9 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ function CreateHTMLDisplayWin(link) {
//find working directory to write user and temp data before starting initialization
function PreInit() {
working_dir = __dirname;
//https://stackoverflow.com/questions/30110814/whats-the-most-portable-way-to-test-if-a-directory-is-writable-in-nodejs
//fs.constants.W_OK => File can be written by the calling process
fs.promises.access(__dirname, fs.constants.W_OK)
.then(() => {Init();})
let test_path = `${__dirname}/test.txt`;
fs.promises.writeFile(test_path, "can write : OK")
.then(() => {
fsExtra.removeSync(test_path);
Init();
})
.catch(err => {
cant_write_to_root = true;
working_dir = path.resolve(app.getPath("appData"), "/Wav2Bar");
Expand Down Expand Up @@ -622,18 +624,18 @@ ipcMain.handle('create-video', async (event, screen, audio_format, fps, duration
switch (audio_format) {
case "audio/mp3":
case "audio/mpeg":
audio_file_path = path.join(__dirname, "/temp/temp.mp3");//.. because __dirname goes in /html.
audio_file_path = path.resolve(working_dir, "./temp/temp.mp3");
break;


case "audio/wav":
case "audio/x-wav":
audio_file_path = path.join(__dirname, "/temp/temp.wav");
audio_file_path = path.resolve(working_dir, "./temp/temp.wav");
break;


case "application/ogg":
audio_file_path = path.join(__dirname, "/temp/temp.ogg");
audio_file_path = path.resolve(working_dir, "./temp/temp.ogg");
break;

default:
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"name": "Wav2Bar",
"shortcutFolderName": "Wav2Bar",
"manufacturer": "Picorims",
"version": "0.1.0",
"version": "0.1.2",
"iconPath": "D:/wav2bar_wix_imgs_U/wav2bar_square_logo.ico",
"ui": {
"chooseDirectory": true,
Expand All @@ -91,8 +91,8 @@
"homepage": "https://picorims.github.io/wav2bar-website",
"icon": "assets/icons/wav2bar_square_logo.png",
"maintainer": "Picorims",
"revision": "0.1.0",
"version": "0.1.0"
"revision": "0.1.2",
"version": "0.1.2"
}
}
},
Expand All @@ -110,7 +110,7 @@
"homepage": "https://picorims.github.io/wav2bar-website",
"icon": "assets/icons/wav2bar_square_logo.png",
"license": "MIT",
"version": "0.1.0"
"version": "0.1.2"
}
}
}
Expand Down

0 comments on commit fa907e7

Please sign in to comment.