@@ -36,8 +36,24 @@ export class Options extends commonOptionsLibPath.OptionsBase {
36
36
copyTo : { type : OptionType . String } ,
37
37
baseConfig : { type : OptionType . String }
38
38
} ,
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" ) ,
40
40
$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
+ }
41
57
}
42
58
}
43
59
$injector . register ( "options" , Options ) ;
0 commit comments