Skip to content

Commit

Permalink
Simple path to file
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Aug 19, 2024
1 parent 8360960 commit f60c7a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 2 additions & 3 deletions Source/Config.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# https://github.com/r57zone/ProtonShell

[Main]
# Application folder address - "%FULLPATH%/", clear the value of "File" if you want to load the website.
File=%FULLPATH%/index.html
# Clear the value of "File" if you want to load the website.
File=index.html
UserAgent=
URL=https://google.ru
# Opening links with "_blank" attribute in external browsers
OpenExternalLinks=1
# Example of the path - "%FULLPATH%/UserScript.js"
UserScript=
# Change system proxy while using the app
SystemProxy=
Expand Down
10 changes: 6 additions & 4 deletions Source/Unit1.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ object Main: TMain
Left = 0
Top = 0
Caption = 'Main'
ClientHeight = 479
ClientWidth = 636
ClientHeight = 480
ClientWidth = 640
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Expand All @@ -18,13 +18,15 @@ object Main: TMain
object EdgeBrowser: TEdgeBrowser
Left = 0
Top = 0
Width = 636
Height = 479
Width = 640
Height = 480
Align = alClient
TabOrder = 0
UserDataFolder = '%LOCALAPPDATA%\bds.exe.WebView2'
OnCreateWebViewCompleted = EdgeBrowserCreateWebViewCompleted
OnNavigationCompleted = EdgeBrowserNavigationCompleted
OnNewWindowRequested = EdgeBrowserNewWindowRequested
ExplicitWidth = 624
ExplicitHeight = 476
end
end
10 changes: 6 additions & 4 deletions Source/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ procedure TMain.FormCreate(Sender: TObject);

FulllPath:=ExtractFilePath(ParamStr(0));
Ini:=TIniFile.Create(FulllPath + 'Config.ini');
LocalFile:=Ini.ReadString('Main', 'File', '');
LocalFile:=Trim(Ini.ReadString('Main', 'File', ''));

// If the path is relative, then add the full path
if (LocalFile <> '') and (Length(LocalFile) > 1) and (LocalFile[2] <> ':') then
LocalFile:=FulllPath + LocalFile;

LocalFile:=StringReplace(LocalFile, '%FULLPATH%/', FulllPath, []);
LocalFile:=StringReplace(LocalFile, '\', '/', [rfReplaceAll]);
EdgeUserAgent:=Ini.ReadString('Main', 'UserAgent', '');
OpenExternalLinks:=Ini.ReadBool('Main', 'OpenExternalLinks', false);
UserScriptPath:=StringReplace(Ini.ReadString('Main', 'UserScript', ''), '%FULLPATH%/', FulllPath, []);
UserScriptPath:=Ini.ReadString('Main', 'UserScript', '');
UserScriptFile:=TStringList.Create;
if FileExists(UserScriptPath) then
UserScriptFile.LoadFromFile(UserScriptPath, TEncoding.UTF8);
Expand Down

0 comments on commit f60c7a8

Please sign in to comment.