@@ -8,38 +8,74 @@ public class Paths
88 public Paths ( ) { }
99
1010 private static readonly string SPCodeAppDataPath = Environment . GetFolderPath ( Environment . SpecialFolder . ApplicationData ) + @"\spcode" ;
11+ private static bool LocalInstallation ;
1112
1213 public static bool IsLocalInstallation ( )
1314 {
1415 var localConfigsPath = @".\sourcepawn\configs\Configs.xml" ;
1516 var localTemplatesPath = @".\sourcepawn\templates\Templates.xml" ;
16- return File . Exists ( localTemplatesPath ) && File . Exists ( localConfigsPath ) ;
17+ if ( File . Exists ( localTemplatesPath ) && File . Exists ( localConfigsPath ) )
18+ {
19+ LocalInstallation = true ;
20+ return true ;
21+ }
22+ else
23+ {
24+ LocalInstallation = false ;
25+ return false ;
26+ }
1727 }
1828
19- public static string GetConfigsFolderPath ( )
29+ public static string GetConfigsDirectory ( )
2030 {
2131 var appDataPath = SPCodeAppDataPath + @"\sourcepawn\configs\sm_1_10_0_6478" ;
2232 var localPath = @".\sourcepawn\configs\sm_1_10_0_6478" ;
23- return IsLocalInstallation ( ) ? localPath : appDataPath ;
33+ return LocalInstallation ? localPath : appDataPath ;
34+ }
35+
36+ public static string GetErrorFilesDirectory ( )
37+ {
38+ var appDataPath = SPCodeAppDataPath + @"\spcode\sourcepawn\errorfiles" ;
39+ var localPath = @".\sourcepawn\errorfiles" ;
40+ return LocalInstallation ? localPath : appDataPath ;
41+ }
42+
43+ public static string GetCrashLogDirectory ( )
44+ {
45+ var appDataPath = SPCodeAppDataPath + @$ "\spcode\crashlogs";
46+ var localPath = @".\crashlogs" ;
47+ if ( LocalInstallation && ! Directory . Exists ( localPath ) )
48+ {
49+ Directory . CreateDirectory ( localPath ) ;
50+ return localPath ;
51+ }
52+ return LocalInstallation ? localPath : appDataPath ;
53+ }
54+
55+ public static string GetTempDirectory ( )
56+ {
57+ var appDataPath = SPCodeAppDataPath + @$ "\spcode\sourcepawn\temp";
58+ var localPath = @".\sourcepawn\temp" ;
59+ return LocalInstallation ? localPath : appDataPath ;
2460 }
2561
2662 public static string GetConfigFilePath ( )
2763 {
2864 var appDataPath = SPCodeAppDataPath + @"\sourcepawn\configs\Configs.xml" ;
2965 var localPath = @".\sourcepawn\configs\Configs.xml" ;
30- return IsLocalInstallation ( ) ? localPath : appDataPath ;
66+ return LocalInstallation ? localPath : appDataPath ;
3167 }
3268
3369 public static string GetTemplatesFilePath ( )
3470 {
3571 var appDataPath = SPCodeAppDataPath + @"\spcode\sourcepawn\templates\Templates.xml" ;
3672 var localPath = @".\sourcepawn\templates\Templates.xml" ;
37- return IsLocalInstallation ( ) ? localPath : appDataPath ;
73+ return LocalInstallation ? localPath : appDataPath ;
3874 }
3975
4076 public static string GetOptionsFilePath ( )
4177 {
42- return IsLocalInstallation ( ) ? @".\options_0.dat" : SPCodeAppDataPath + @"\options_0.dat" ;
78+ return LocalInstallation ? @".\options_0.dat" : SPCodeAppDataPath + @"\options_0.dat" ;
4379 }
4480 }
4581}
0 commit comments