From f60c7a843cbdc0bb264568eae7e90e223ec39c30 Mon Sep 17 00:00:00 2001 From: r57zone Date: Mon, 19 Aug 2024 22:54:12 +0400 Subject: [PATCH] Simple path to file --- Source/Config.ini | 5 ++--- Source/Unit1.dfm | 10 ++++++---- Source/Unit1.pas | 10 ++++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Source/Config.ini b/Source/Config.ini index b9e8cfc..8fe38a7 100644 --- a/Source/Config.ini +++ b/Source/Config.ini @@ -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= diff --git a/Source/Unit1.dfm b/Source/Unit1.dfm index 71bd114..ef402f7 100644 --- a/Source/Unit1.dfm +++ b/Source/Unit1.dfm @@ -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 @@ -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 diff --git a/Source/Unit1.pas b/Source/Unit1.pas index 0d06d0b..0a759ad 100644 --- a/Source/Unit1.pas +++ b/Source/Unit1.pas @@ -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);