Skip to content

Commit fbb0f15

Browse files
committed
Move settings into Roaming Windows profile
See #1412 - Change the default settings dir to be inside Roaming Windows profile - Move the existing file to its new location, if applicable - Remove the source comment which indicates that separate {N} provacy policy is needed - it is not
1 parent 8d93603 commit fbb0f15

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/options.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,24 @@ export class Options extends commonOptionsLibPath.OptionsBase {
3636
copyTo: { type: OptionType.String },
3737
baseConfig: { type: OptionType.String }
3838
},
39-
path.join($hostInfo.isWindows ? process.env.LocalAppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
39+
path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
4040
$errors, $staticConfig);
41+
42+
// On Windows we moved settings from LocalAppData to AppData. Move the existing file to keep the existing settings
43+
// I guess we can remove this code after some grace period, say after 1.7 is out
44+
if ($hostInfo.isWindows) {
45+
try {
46+
let shelljs = require("shelljs"),
47+
oldSettings = path.join(process.env.LocalAppData, ".nativescript-cli", "user-settings.json"),
48+
newSettings = path.join(process.env.AppData, ".nativescript-cli", "user-settings.json");
49+
if (shelljs.test("-e", oldSettings) && !shelljs.test("-e", newSettings)) {
50+
shelljs.mkdir(path.join(process.env.AppData, ".nativescript-cli"));
51+
shelljs.mv(oldSettings, newSettings);
52+
}
53+
} catch (err) {
54+
// ignore the error - it is too early to use $logger here
55+
}
56+
}
4157
}
4258
}
4359
$injector.register("options", Options);

lib/services/analytics-settings-service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class AnalyticsSettingsService implements IAnalyticsSettingsService {
1818
}
1919

2020
public getPrivacyPolicyLink(): string {
21-
// TODO: Replace with nativescript privacy-policy link, when such exists.
2221
return "http://www.telerik.com/company/privacy-policy";
2322
}
2423
}

0 commit comments

Comments
 (0)