Fixup for OneDrive on some windows installs.

Not perfect but based on values seen and reported,less hassle than trying to package a windows specific node module
merge-requests/45/head
Tag 2021-01-03 11:56:30 -08:00
rodzic daee3fe7c2
commit d57b7f6c53
1 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -15385,13 +15385,24 @@ function mediaCheck()
{ {
g_appData = path.join(homeDir, "Documents"); g_appData = path.join(homeDir, "Documents");
if (!is_dir(g_appData)) if (!is_dir(g_appData))
{
g_appData = path.join(homeDir, "OneDrive\\Documents")
if (!is_dir(g_appData))
{
g_appData = path.join(homeDir, "OneDrive\\Dokumente")
if (!is_dir(g_appData))
{ {
if (g_appSettings.savedAppData != null) if (g_appSettings.savedAppData != null)
{ {
g_appData = g_appSettings.savedAppData; g_appData = g_appSettings.savedAppData;
if (!is_dir(g_appData)) return false; if (!is_dir(g_appData)) return false;
} }
else return false; else
{
return false;
}
}
}
} }
} }
@ -15405,6 +15416,7 @@ function mediaCheck()
try try
{ {
var tryDirectory = "";
var userdirs = [ var userdirs = [
g_appData, g_appData,
g_NWappData, g_NWappData,
@ -15416,6 +15428,7 @@ function mediaCheck()
{ {
if (!fs.existsSync(dir)) if (!fs.existsSync(dir))
{ {
tryDirectory = dir;
fs.mkdirSync(dir); fs.mkdirSync(dir);
} }
} }
@ -15423,9 +15436,7 @@ function mediaCheck()
catch (e) catch (e)
{ {
alert( alert(
"Unable to create or access " + "Unable to create or access " + tryDirectory + " folder.\r\nPermission violation, GT cannot continue"
g_appData +
" folder.\r\nPermission violation, GT cannot continue"
); );
nw.App.quit(); nw.App.quit();
} }