From fc22be3be36790679308d0bc1e8ef5a83664bec3 Mon Sep 17 00:00:00 2001 From: Idan Miara Date: Tue, 30 Dec 2025 20:18:30 +0200 Subject: [PATCH 1/5] cAppPaths --- Source/PyScripter.dpr | 1 + Source/cAppPaths.pas | 67 ++++++++++++++++++++++++++++++++++ Source/cPyRemoteDebugger.pas | 5 ++- Source/cPyScripterSettings.pas | 13 ++++--- Source/frmPyIDEMain.pas | 7 ++-- 5 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 Source/cAppPaths.pas diff --git a/Source/PyScripter.dpr b/Source/PyScripter.dpr index 51971b2a9..acb80f3a6 100644 --- a/Source/PyScripter.dpr +++ b/Source/PyScripter.dpr @@ -100,6 +100,7 @@ uses cCodeCompletion in 'cCodeCompletion.pas', dlgStyleSelector in 'dlgStyleSelector.pas' {StyleSelectorForm}, VCL.Styles.PyScripter in 'VCL.Styles.PyScripter.pas' {/ Vcl.Styles.Utils.Forms;}, + cAppPaths in 'cAppPaths.pas', cPyScripterSettings in 'cPyScripterSettings.pas', cPySupportTypes in 'cPySupportTypes.pas', cPyControl in 'cPyControl.pas', diff --git a/Source/cAppPaths.pas b/Source/cAppPaths.pas new file mode 100644 index 000000000..c949bcd1e --- /dev/null +++ b/Source/cAppPaths.pas @@ -0,0 +1,67 @@ +{----------------------------------------------------------------------------- + Unit Name: cAppPaths + Author: PyScripter + Date: 30-Dec-2026 + Purpose: Holds the App paths + History: +-----------------------------------------------------------------------------} + +unit cAppPaths; + +interface + +function GetEXEPath: String; +function GetAppRootPath: String; +function GetAppName: String; + + +implementation + +uses + System.SysUtils, + System.IOUtils, + Vcl.Forms; + +var + AppName: string; + + // paths including trailing path delimiter + EXEPath: string; + AppRootPath: string; + +function GetAppName: String; +begin + Result := AppName; +end; + +function GetEXEPath: String; +begin + Result := EXEPath; +end; + +function GetAppRootPath: String; +begin + Result := AppRootPath; +end; + +procedure InitPaths; +var + DirName: String; +begin + AppName := TPath.GetFileNameWithoutExtension(Application.ExeName); + EXEPath := ExtractFilePath(Application.ExeName); + DirName := LowerCase(ExtractFileName(ExcludeTrailingPathDelimiter(EXEPath))); + {$IFDEF WIN64} + if (DirName = 'x64') or (DirName = 'bin64') then + {$ELSE} + if (DirName = 'x86') or (DirName = 'bin') then + {$ENDIF} + AppRootPath := ExtractFilePath(ExcludeTrailingPathDelimiter(EXEPath)) + else + AppRootPath := EXEPath; +end; + +initialization + InitPaths; + +end. diff --git a/Source/cPyRemoteDebugger.pas b/Source/cPyRemoteDebugger.pas index 24396f99b..f98f4c595 100644 --- a/Source/cPyRemoteDebugger.pas +++ b/Source/cPyRemoteDebugger.pas @@ -187,7 +187,8 @@ implementation cPyScripterSettings, cPyControl, cTools, - uCommonFunctions; + uCommonFunctions, + cAppPaths; { TRemNameSpaceItem } constructor TRemNameSpaceItem.Create(AName: string; const APyObject: Variant; @@ -497,7 +498,7 @@ constructor TPyRemoteInterpreter.Create(AEngineType: TPythonEngineType = peRemot FOldsysmodules := SysModule.modules.copy(); try - FRpycPath := Format('%sLib\%s', [ExtractFilePath(Application.ExeName), RpycZipModule]); + FRpycPath := Format('%sLib\%s', [GetAppRootPath, RpycZipModule]); GI_PyControl.InternalInterpreter.SysPathAdd(FRpycPath); Rpyc := Import('rpyc'); FServerIsAvailable := True; diff --git a/Source/cPyScripterSettings.pas b/Source/cPyScripterSettings.pas index 1f7582b27..4f42bfc48 100644 --- a/Source/cPyScripterSettings.pas +++ b/Source/cPyScripterSettings.pas @@ -434,7 +434,8 @@ implementation SynUnicode, SynEditRegexSearch, StringResources, - uCommonFunctions; + uCommonFunctions, + cAppPaths; { TPythonIDEOptions } @@ -1131,18 +1132,18 @@ class procedure TPyScripterSettings.CreateSearchOptions; var PublicPath: string; - AppName, AppININame, EXEPath: string; + AppName, AppININame, AppRootPath: string; begin - AppName := TPath.GetFileNameWithoutExtension(Application.ExeName); + AppName := GetAppName; AppININame := AppName + '.ini'; - EXEPath := TPath.GetDirectoryName(Application.ExeName); + AppRootPath := GetAppRootPath; - OptionsFileName := TPath.Combine(EXEPath, AppININame); + OptionsFileName := TPath.Combine(AppRootPath, AppININame); IsPortable := FileExists(OptionsFileName); if IsPortable then begin // Portable version - nothing is stored in other directories - UserDataPath := EXEPath; + UserDataPath := AppRootPath; ColorThemesFilesDir := TPath.Combine(UserDataPath, 'Highlighters'); StylesFilesDir := TPath.Combine(UserDataPath, 'Styles'); LspServerPath := TPath.Combine(UserDataPath, 'Lib', 'Lsp'); diff --git a/Source/frmPyIDEMain.pas b/Source/frmPyIDEMain.pas index 0241df486..c21371e96 100644 --- a/Source/frmPyIDEMain.pas +++ b/Source/frmPyIDEMain.pas @@ -718,7 +718,8 @@ interface SynEdit, uEditAppIntfs, cFileTemplates, - cPySupportTypes; + cPySupportTypes, + cAppPaths; const WM_FINDDEFINITION = WM_USER + 100; @@ -1464,7 +1465,7 @@ procedure TPyIDEMainForm.FormCreate(Sender: TObject); MulDiv(FShellImages.Height, FCurrentPPI, Screen.PixelsPerInch)); //Set the HelpFile - Application.HelpFile := ExtractFilePath(Application.ExeName) + 'PyScripter.chm'; + Application.HelpFile := GetAppRootPath + 'PyScripter.chm'; // In zip distributions the help file may be blocked if IsFileBlocked(Application.HelpFile) then UnblockFile(Application.HelpFile); @@ -2854,7 +2855,7 @@ procedure TPyIDEMainForm.SetupLanguageMenu; begin mnLanguage.Clear; CurrentLanguage := GetCurrentLanguage; - DefaultInstance.bindtextdomainToFile ('languagecodes',ExtractFilePath(Application.ExeName)+'locale\languagecodes.mo'); + DefaultInstance.bindtextdomainToFile ('languagecodes',GetAppRootPath+'locale\languagecodes.mo'); DefaultInstance.GetListOfLanguages ('default',FLanguageList); FLanguageList.Insert(0, 'en'); HaveLang := False; From 536f18059797aed952e548a4f7c34adccdcc2659 Mon Sep 17 00:00:00 2001 From: Idan Miara Date: Tue, 30 Dec 2025 21:25:44 +0200 Subject: [PATCH 2/5] move WebView2Loader.dll binaries dirs to the root --- .../Dependencies/x64 => x64}/WebView2Loader.dll | Bin .../Dependencies/x86 => x86}/WebView2Loader.dll | Bin 2 files changed, 0 insertions(+), 0 deletions(-) rename {Install/Dependencies/x64 => x64}/WebView2Loader.dll (100%) rename {Install/Dependencies/x86 => x86}/WebView2Loader.dll (100%) diff --git a/Install/Dependencies/x64/WebView2Loader.dll b/x64/WebView2Loader.dll similarity index 100% rename from Install/Dependencies/x64/WebView2Loader.dll rename to x64/WebView2Loader.dll diff --git a/Install/Dependencies/x86/WebView2Loader.dll b/x86/WebView2Loader.dll similarity index 100% rename from Install/Dependencies/x86/WebView2Loader.dll rename to x86/WebView2Loader.dll From c90ba147a05ef5099b13d00dfb3059ad54f731bd Mon Sep 17 00:00:00 2001 From: Idan Miara Date: Tue, 30 Dec 2025 21:29:55 +0200 Subject: [PATCH 3/5] PyScripter.dproj - remove WebView2Loader.dll post build copy event and change the build dir to x86/x64 subdir --- Source/PyScripter.dproj | 823 +++++++++++++++++++--------------------- 1 file changed, 396 insertions(+), 427 deletions(-) diff --git a/Source/PyScripter.dproj b/Source/PyScripter.dproj index 193c89aa3..226904e2f 100644 --- a/Source/PyScripter.dproj +++ b/Source/PyScripter.dproj @@ -1,427 +1,396 @@ - - - True - Application - Debug - DCC32 - VCL - PyScripter.dpr - Win64 - {FD7531E1-BDA2-4EF3-A3E8-074B952317EF} - PyScripter - 20.3 - 3 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - PyScripter - "Windows11 Impressive Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Light.vsf";"Windows11 MineShaft|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_MineShaft.vsf" - .\$(Platform)\$(Config) - PyScripter.exe - .\.. - 00400000 - 3 - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) - x86 - false - off - false - vcl;rtl;vcldb;dbrtl;vclx;xmlrtl;vclie;inetdbbde;inet;inetdbxpress;IndySystem;IndyCore;dclOfficeXP;VclSmp;soaprtl;dsnap;IndyProtocols;inetdb;bdertl;vcldbx;vclactnband;vclshlctrls;teeui;teedb;tee;DJcl;JvStdCtrlsD9R;JvAppFrmD9R;JvCoreD9R;JvBandsD9R;JvDlgsD9R;JvCmpD9R;JvCtrlsD9R;JvCustomD9R;JvDockingD9R;JvHMID9R;JvInspectorD9R;JvPageCompsD9R;JvPluginD9R;JvSystemD9R;JvValidatorsD9R;Python_bds3;SynEdit_R2005;tb2k_d9;tbx_d9;VirtualTreesD9;VirtualShellToolsD9;FreeComp9;DJclVcl;mbTBXJvLibD9D;JvRuntimeDesignD9R;$(DCC_UsePackage) - PyScripter_Icon.ico - None - - Carbon|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Carbon.vsf;Coral|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Coral.vsf;Jet|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Jet.vsf;Luna|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Luna.vsf;Windows10|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Windows10.vsf - true - CompanyName=;FileDescription=PyScripter Python IDE;FileVersion=5.3.1.0;InternalName=;LegalCopyright=(c) Kiriakos Vlahos;LegalTrademarks=;OriginalFilename=PyScripter.exe;ProductName=PyScripter;ProductVersion=5.3.0.0;Comments= - 2057 - 5 - 3 - 1 - - - system - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - PyScripter_Icon1.ico - PyScripter.exe.manifest - - - system - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - PyScripter_Icon1.ico - PyScripter.exe.manifest - - - 0 - RELEASE;$(DCC_Define) - false - 0 - - - DEBUG;$(DCC_Define) - - - true - true - Debug - true - true - true - DetailedSegments - 3 - - - Debug - true - DetailedSegments - 3 - - - - MainSource - - - -
ExceptionDialogMail
-
- -
PyIDEMainForm
-
- - -
EditorForm
-
- -
ResourcesDataModule
- TDataModule -
- -
CommandsDataModule
- TDataModule -
- - -
ConfirmReplaceDialog
-
- -
PythonIIForm
-
- -
MessagesWindow
-
- - -
PageSetupDlg
-
- -
PrintPreviewDlg
-
- -
CallStackWindow
-
- -
BreakPointsWindow
-
- -
WatchesWindow
-
- -
VariablesWindow
-
- -
CodeExplorerWindow
-
- -
OptionsInspector
-
- -
DirectoryListDialog
-
- -
FileExplorerWindow
-
- -
IDEDockWindow
-
- -
DisForm
-
- -
DocForm
-
- -
WebPreviewForm
-
- - -
ToDoWindow
-
- -
ToDoOptionsDlg
-
- - - -
FindInFilesDialog
-
- -
FindResultsWindow
-
- -
FindResultsOptionsDialog
-
- -
ReplaceInFilesDialog
-
- - - -
CustomizeParams
-
- -
AskParamForm
-
- -
FileTemplatesDialog
-
- - -
CollectionEditor
-
- -
ToolProperties
-
- -
OutputWindow
-
- -
FunctionListWindow
-
- - - - -
RegExpTesterWindow
-
- - -
CommandLineDlg
-
- -
frmCustomKeyboard
-
- -
UnitTestWizard
-
- -
UnitTestWindow
-
- - -
PickListDialog
-
- -
AboutBox
-
- - - - -
CodeTemplates
-
- -
NewFileDialog
-
- - - - - - -
ProjectExplorerWindow
-
- -
ImportDirectoryForm
-
- -
RunConfigurationForm
-
- -
PyIDEDlgBase
-
- - -
EditorOptionsDialog
- TForm -
- - - - -
StyleSelectorForm
-
- -
/ Vcl.Styles.Utils.Forms;
-
- - - - - - -
PythonVersionsDialog
-
- - -
RemoteFileDialog
-
- - - - - - - - - -
LLMChatForm
-
- -
SuggestWindow
-
- - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - -
- - - Delphi.Personality.12 - VCLApplication - - - - PyScripter.dpr - - - - True - False - False - False - False - False - False - 2057 - 1252 - - - - PyScripter Python IDE - 2.4.4.0 - - - - - PyScripter - 1.0.0.0 - - - - False - True - False - - - False - - True - True - - - - WinApi;System.Win;System;Data;Vcl - - - - 12 - - - - - - False - - False - copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) - False - - - - False - - False - copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) - False - - - - False - - False - copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) - False - - - - False - - False - copy "$(BDS)\Redist\$(Platform)\WebView2Loader.dll" $(OUTPUTDIR) - False - -
+ + + True + Application + Debug + DCC32 + VCL + PyScripter.dpr + Win64 + {FD7531E1-BDA2-4EF3-A3E8-074B952317EF} + PyScripter + 20.3 + 3 + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + PyScripter + "Windows11 Impressive Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Light.vsf";"Windows11 MineShaft|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_MineShaft.vsf" + .\$(Platform)\$(Config) + PyScripter.exe + .\.. + 00400000 + 3 + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) + x86 + false + off + false + vcl;rtl;vcldb;dbrtl;vclx;xmlrtl;vclie;inetdbbde;inet;inetdbxpress;IndySystem;IndyCore;dclOfficeXP;VclSmp;soaprtl;dsnap;IndyProtocols;inetdb;bdertl;vcldbx;vclactnband;vclshlctrls;teeui;teedb;tee;DJcl;JvStdCtrlsD9R;JvAppFrmD9R;JvCoreD9R;JvBandsD9R;JvDlgsD9R;JvCmpD9R;JvCtrlsD9R;JvCustomD9R;JvDockingD9R;JvHMID9R;JvInspectorD9R;JvPageCompsD9R;JvPluginD9R;JvSystemD9R;JvValidatorsD9R;Python_bds3;SynEdit_R2005;tb2k_d9;tbx_d9;VirtualTreesD9;VirtualShellToolsD9;FreeComp9;DJclVcl;mbTBXJvLibD9D;JvRuntimeDesignD9R;$(DCC_UsePackage) + PyScripter_Icon.ico + None + Carbon|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Carbon.vsf;Coral|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Coral.vsf;Jet|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Jet.vsf;Luna|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Luna.vsf;Windows10|VCLSTYLE|$(PUBLIC)\Documents\Embarcadero\Studio\15.0\Styles\Windows10.vsf + true + CompanyName=;FileDescription=PyScripter Python IDE;FileVersion=5.3.1.0;InternalName=;LegalCopyright=(c) Kiriakos Vlahos;LegalTrademarks=;OriginalFilename=PyScripter.exe;ProductName=PyScripter;ProductVersion=5.3.0.0;Comments= + 2057 + 5 + 3 + 1 + + + system + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + PyScripter_Icon1.ico + PyScripter.exe.manifest + .\..\x86 + + + system + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + PyScripter_Icon1.ico + PyScripter.exe.manifest + .\..\x64 + + + 0 + RELEASE;$(DCC_Define) + false + 0 + + + DEBUG;$(DCC_Define) + + + true + true + Debug + true + true + true + DetailedSegments + 3 + + + Debug + true + DetailedSegments + 3 + + + + MainSource + + + +
ExceptionDialogMail
+
+ +
PyIDEMainForm
+
+ + +
EditorForm
+
+ +
ResourcesDataModule
+ TDataModule +
+ +
CommandsDataModule
+ TDataModule +
+ + +
ConfirmReplaceDialog
+
+ +
PythonIIForm
+
+ +
MessagesWindow
+
+ + +
PageSetupDlg
+
+ +
PrintPreviewDlg
+
+ +
CallStackWindow
+
+ +
BreakPointsWindow
+
+ +
WatchesWindow
+
+ +
VariablesWindow
+
+ +
CodeExplorerWindow
+
+ +
OptionsInspector
+
+ +
DirectoryListDialog
+
+ +
FileExplorerWindow
+
+ +
IDEDockWindow
+
+ +
DisForm
+
+ +
DocForm
+
+ +
WebPreviewForm
+
+ + +
ToDoWindow
+
+ +
ToDoOptionsDlg
+
+ + + +
FindInFilesDialog
+
+ +
FindResultsWindow
+
+ +
FindResultsOptionsDialog
+
+ +
ReplaceInFilesDialog
+
+ + + +
CustomizeParams
+
+ +
AskParamForm
+
+ +
FileTemplatesDialog
+
+ + +
CollectionEditor
+
+ +
ToolProperties
+
+ +
OutputWindow
+
+ +
FunctionListWindow
+
+ + + + +
RegExpTesterWindow
+
+ + +
CommandLineDlg
+
+ +
frmCustomKeyboard
+
+ +
UnitTestWizard
+
+ +
UnitTestWindow
+
+ + +
PickListDialog
+
+ +
AboutBox
+
+ + + + +
CodeTemplates
+
+ +
NewFileDialog
+
+ + + + + + +
ProjectExplorerWindow
+
+ +
ImportDirectoryForm
+
+ +
RunConfigurationForm
+
+ +
PyIDEDlgBase
+
+ + +
EditorOptionsDialog
+ TForm +
+ + + + +
StyleSelectorForm
+
+ +
/ Vcl.Styles.Utils.Forms;
+
+ + + + + + + +
PythonVersionsDialog
+
+ + +
RemoteFileDialog
+
+ + + + + + + + + +
LLMChatForm
+
+ +
SuggestWindow
+
+ + + + + Base + + + Cfg_1 + Base + + + Cfg_2 + Base + +
+ + + Delphi.Personality.12 + VCLApplication + + + + PyScripter.dpr + + + + True + False + False + False + False + False + False + 2057 + 1252 + + + + PyScripter Python IDE + 2.4.4.0 + + + + + PyScripter + 1.0.0.0 + + + + False + True + False + + + False + + True + True + + + + WinApi;System.Win;System;Data;Vcl + + + + 12 + + + +
From 33b10fb881560b58463aad2edbce84c3d7b6646a Mon Sep 17 00:00:00 2001 From: Idan Miara Date: Sun, 23 Nov 2025 19:23:16 +0200 Subject: [PATCH 4/5] Update .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9a9fe8b7f..8d59327af 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,6 @@ VirtualTreeView.zip *.chw /Lib/Lsp/jls/jedilsp /WebView2Loader.dll -/Help/build \ No newline at end of file +/Help/build + +.idea \ No newline at end of file From acce61f93244182aab34cd6fdf7fd49fd2876e1b Mon Sep 17 00:00:00 2001 From: Idan Miara Date: Tue, 30 Dec 2025 22:43:52 +0200 Subject: [PATCH 5/5] update iss file for the new location of WebView2Loader.dll --- Install/PyScripter.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install/PyScripter.iss b/Install/PyScripter.iss index accdb8526..8afbc4fec 100644 --- a/Install/PyScripter.iss +++ b/Install/PyScripter.iss @@ -58,7 +58,7 @@ Source: ..\PyScripter.exe; DestDir: {app}; Flags: ignoreversion Source: ..\PyScripter.chm; DestDir: {app}; Flags: ignoreversion Source: ..\Source\PyProject.ico; DestDir: {app} Source: ..\Lib\rpyc.zip; DestDir: {app}\Lib -Source: Dependencies\{#OSPlatform}\WebView2Loader.dll; DestDir: {app}; Flags: ignoreversion +Source: ..\{#OSPlatform}\WebView2Loader.dll; DestDir: {app}; Flags: ignoreversion Source: Dependencies\MicrosoftEdgeWebview2Setup.exe; DestDir: "{commonappdata}\PyScripter"; Flags: ignoreversion ; localization Source: ..\locale\default.pot; DestDir: {app}\locale