@@ -3780,7 +3780,6 @@ constructor TAppSettings.Create;
37803780var
37813781 rx: TRegExpr;
37823782 i: Integer;
3783- DefaultSnippetsDirectory: String;
37843783 PortableLockFile: String;
37853784 NewFileHandle: THandle;
37863785begin
@@ -4058,14 +4057,7 @@ constructor TAppSettings.Create;
40584057 InitSetting(asDisplayReverseForeignKeys, ' DisplayReverseForeignKeys' , 0 , False);
40594058 InitSetting(asGenerateDataNumRows, ' GenerateDataNumRows' , 1000 );
40604059 InitSetting(asGenerateDataNullAmount, ' GenerateDataNullAmount' , 10 );
4061-
4062- // Default folder for snippets
4063- if FPortableMode then
4064- DefaultSnippetsDirectory := GetAppDir
4065- else
4066- DefaultSnippetsDirectory := DirnameUserDocuments;
4067- DefaultSnippetsDirectory := DefaultSnippetsDirectory + ' Snippets\' ;
4068- InitSetting(asCustomSnippetsDirectory, ' CustomSnippetsDirectory' , 0 , False, DefaultSnippetsDirectory);
4060+ InitSetting(asCustomSnippetsDirectory, ' CustomSnippetsDirectory' , 0 , False, DirnameUserDocuments + ' Snippets\' );
40694061 InitSetting(asPromptSaveFileOnTabClose, ' PromptSaveFileOnTabClose' , 0 , True);
40704062 // Restore tabs feature crashes often on old XP systems, see https://www.heidisql.com/forum.php?t=34044
40714063 InitSetting(asRestoreTabs, ' RestoreTabs' , 0 , Win32MajorVersion >= 6 );
@@ -4723,19 +4715,29 @@ function TAppSettings.ExportSettings: Boolean;
47234715
47244716function TAppSettings.DirnameUserAppData : String;
47254717begin
4726- // User folder for HeidiSQL's data (<user name>\Application Data)
4727- Result := GetShellFolder(FOLDERID_RoamingAppData) + ' \' + APPNAME + ' \' ;
4728- if not DirectoryExists(Result) then begin
4729- ForceDirectories(Result);
4718+ // C:\Users\mike\AppData\Roaming\HeidiSQL\
4719+ if PortableMode then begin
4720+ Result := GetAppDir;
4721+ end
4722+ else begin
4723+ Result := GetShellFolder(FOLDERID_RoamingAppData) + ' \' + APPNAME + ' \' ;
4724+ if not DirectoryExists(Result) then begin
4725+ ForceDirectories(Result);
4726+ end ;
47304727 end ;
47314728end ;
47324729
47334730
47344731function TAppSettings.DirnameUserDocuments : String;
47354732begin
4736- // "HeidiSQL" folder under user's documents folder, e.g. c:\Users\Mike\Documents\HeidiSQL\
4737- Result := GetShellFolder(FOLDERID_Documents) + ' \' + APPNAME + ' \' ;
4738- // Do not auto-create it, as we only use it for snippets which can also have a custom path.
4733+ // C:\Users\mike\Documents\HeidiSQL\
4734+ if PortableMode then begin
4735+ Result := GetAppDir;
4736+ end
4737+ else begin
4738+ Result := GetShellFolder(FOLDERID_Documents) + ' \' + APPNAME + ' \' ;
4739+ // Do not auto-create it, as we only use it for snippets which can also have a custom path.
4740+ end ;
47394741end ;
47404742
47414743
@@ -4755,11 +4757,7 @@ function TAppSettings.DirnameSnippets: String;
47554757function TAppSettings.DirnameBackups : String;
47564758begin
47574759 // Create backup folder if it does not exist and return it
4758- if PortableMode then begin
4759- Result := GetAppDir + ' Backups\'
4760- end else begin
4761- Result := DirnameUserAppData + ' Backups\' ;
4762- end ;
4760+ Result := DirnameUserAppData + ' Backups\' ;
47634761 if not DirectoryExists(Result) then begin
47644762 ForceDirectories(Result);
47654763 end ;
@@ -4768,11 +4766,7 @@ function TAppSettings.DirnameBackups: String;
47684766
47694767function TAppSettings.DirnameHighlighters : string;
47704768begin
4771- if PortableMode then begin
4772- Result := GetAppDir + ' Highlighters\'
4773- end else begin
4774- Result := DirnameUserAppData + ' Highlighters\' ;
4775- end ;
4769+ Result := DirnameUserAppData + ' Highlighters\' ;
47764770 if not DirectoryExists(Result) then begin
47774771 ForceDirectories(Result);
47784772 end ;
0 commit comments