Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ VirtualTreeView.zip
*.chw
/Lib/Lsp/jls/jedilsp
/WebView2Loader.dll
/Help/build
/Help/build

.idea
2 changes: 1 addition & 1 deletion Install/PyScripter.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Source/PyScripter.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
823 changes: 396 additions & 427 deletions Source/PyScripter.dproj

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions Source/cAppPaths.pas
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions Source/cPyRemoteDebugger.pas
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ implementation
cPyScripterSettings,
cPyControl,
cTools,
uCommonFunctions;
uCommonFunctions,
cAppPaths;

{ TRemNameSpaceItem }
constructor TRemNameSpaceItem.Create(AName: string; const APyObject: Variant;
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 7 additions & 6 deletions Source/cPyScripterSettings.pas
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ implementation
SynUnicode,
SynEditRegexSearch,
StringResources,
uCommonFunctions;
uCommonFunctions,
cAppPaths;

{ TPythonIDEOptions }

Expand Down Expand Up @@ -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');
Expand Down
7 changes: 4 additions & 3 deletions Source/frmPyIDEMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ interface
SynEdit,
uEditAppIntfs,
cFileTemplates,
cPySupportTypes;
cPySupportTypes,
cAppPaths;

const
WM_FINDDEFINITION = WM_USER + 100;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
File renamed without changes.
File renamed without changes.