Skip to content

Commit f60c7a8

Browse files
committed
Simple path to file
1 parent 8360960 commit f60c7a8

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Source/Config.ini

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# https://github.com/r57zone/ProtonShell
22

33
[Main]
4-
# Application folder address - "%FULLPATH%/", clear the value of "File" if you want to load the website.
5-
File=%FULLPATH%/index.html
4+
# Clear the value of "File" if you want to load the website.
5+
File=index.html
66
UserAgent=
77
URL=https://google.ru
88
# Opening links with "_blank" attribute in external browsers
99
OpenExternalLinks=1
10-
# Example of the path - "%FULLPATH%/UserScript.js"
1110
UserScript=
1211
# Change system proxy while using the app
1312
SystemProxy=

Source/Unit1.dfm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ object Main: TMain
22
Left = 0
33
Top = 0
44
Caption = 'Main'
5-
ClientHeight = 479
6-
ClientWidth = 636
5+
ClientHeight = 480
6+
ClientWidth = 640
77
Color = clBtnFace
88
Font.Charset = DEFAULT_CHARSET
99
Font.Color = clWindowText
@@ -18,13 +18,15 @@ object Main: TMain
1818
object EdgeBrowser: TEdgeBrowser
1919
Left = 0
2020
Top = 0
21-
Width = 636
22-
Height = 479
21+
Width = 640
22+
Height = 480
2323
Align = alClient
2424
TabOrder = 0
2525
UserDataFolder = '%LOCALAPPDATA%\bds.exe.WebView2'
2626
OnCreateWebViewCompleted = EdgeBrowserCreateWebViewCompleted
2727
OnNavigationCompleted = EdgeBrowserNavigationCompleted
2828
OnNewWindowRequested = EdgeBrowserNewWindowRequested
29+
ExplicitWidth = 624
30+
ExplicitHeight = 476
2931
end
3032
end

Source/Unit1.pas

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ procedure TMain.FormCreate(Sender: TObject);
161161

162162
FulllPath:=ExtractFilePath(ParamStr(0));
163163
Ini:=TIniFile.Create(FulllPath + 'Config.ini');
164-
LocalFile:=Ini.ReadString('Main', 'File', '');
164+
LocalFile:=Trim(Ini.ReadString('Main', 'File', ''));
165+
166+
// If the path is relative, then add the full path
167+
if (LocalFile <> '') and (Length(LocalFile) > 1) and (LocalFile[2] <> ':') then
168+
LocalFile:=FulllPath + LocalFile;
165169

166-
LocalFile:=StringReplace(LocalFile, '%FULLPATH%/', FulllPath, []);
167-
LocalFile:=StringReplace(LocalFile, '\', '/', [rfReplaceAll]);
168170
EdgeUserAgent:=Ini.ReadString('Main', 'UserAgent', '');
169171
OpenExternalLinks:=Ini.ReadBool('Main', 'OpenExternalLinks', false);
170-
UserScriptPath:=StringReplace(Ini.ReadString('Main', 'UserScript', ''), '%FULLPATH%/', FulllPath, []);
172+
UserScriptPath:=Ini.ReadString('Main', 'UserScript', '');
171173
UserScriptFile:=TStringList.Create;
172174
if FileExists(UserScriptPath) then
173175
UserScriptFile.LoadFromFile(UserScriptPath, TEncoding.UTF8);

0 commit comments

Comments
 (0)