simplewebservergui: forcedir for main dir

This commit is contained in:
mattias 2022-04-14 18:06:43 +02:00
parent 0e03eadf14
commit 322e4f468e
5 changed files with 107 additions and 58 deletions

View File

@ -589,7 +589,6 @@ function TProjectPas2JSProgressiveWebApp.CreateProjectGroup(
AProject: TLazProject): boolean;
var
LPGFilename, ServiceWorkerLPI, WebAppLPI: String;
Cfg: TXMLConfig;
Grp: TProjectGroup;
begin
Result:=false;

View File

@ -26,7 +26,7 @@ msgid "Binding of socket failed"
msgstr ""
#: simplewebsrvstrconsts.rsswbrowsertoopenhtmlpagemacroswsbrowser
msgid "Browser to open HTML page (macro $(SWSBrowser))"
msgid "Browser to open HTML page, macro $(SWSBrowser)"
msgstr ""
#: simplewebsrvstrconsts.rsswcannotfindbrowsersee
@ -52,7 +52,7 @@ msgid "Delete server at \"%s\"?"
msgstr ""
#: simplewebsrvstrconsts.rsswdirectorynotfound
msgid "Directory not found."
msgid "Directory not found"
msgstr ""
#: simplewebsrvstrconsts.rsswerror
@ -61,7 +61,7 @@ msgstr ""
#: simplewebsrvstrconsts.rsswerrorcheckingwhichprocessusestcpport
#, object-pascal-format
msgid "Error checking which process uses TCP port %s:"
msgid "Error checking which process uses TCP port %s"
msgstr ""
#: simplewebsrvstrconsts.rsswerrorcreatingdirectory
@ -74,12 +74,12 @@ msgstr ""
#: simplewebsrvstrconsts.rsswerrorkillingprocess
#, object-pascal-format
msgid "Error killing process %s:"
msgid "Error killing process %s"
msgstr ""
#: simplewebsrvstrconsts.rsswerrorwriting
#, object-pascal-format
msgid "Error writing \"%s\":"
msgid "Error writing \"%s\""
msgstr ""
#: simplewebsrvstrconsts.rsswexecutable
@ -96,7 +96,7 @@ msgid "Invalid macro. See"
msgstr ""
#: simplewebsrvstrconsts.rsswinvalidport
msgid "Invalid Port."
msgid "Invalid Port"
msgstr ""
#: simplewebsrvstrconsts.rsswkillpid
@ -121,7 +121,7 @@ msgid "Location"
msgstr ""
#: simplewebsrvstrconsts.rsswlocationalreadyused
msgid "Location already used."
msgid "Location already used"
msgstr ""
#: simplewebsrvstrconsts.rsswmissingcontroller
@ -129,23 +129,23 @@ msgid "missing controller"
msgstr ""
#: simplewebsrvstrconsts.rsswmissinglocaldirectory
msgid "Missing local directory."
msgid "Missing local directory"
msgstr ""
#: simplewebsrvstrconsts.rsswmissinglocation
msgid "Missing Location."
msgid "Missing Location"
msgstr ""
#: simplewebsrvstrconsts.rsswmissingserverexecutable
msgid "Missing server executable."
msgid "Missing server executable"
msgstr ""
#: simplewebsrvstrconsts.rsswparameterspleaseusemacroport
msgid "Parameters (please use macro $(port))"
msgid "Parameters, please use macro $(port)"
msgstr ""
#: simplewebsrvstrconsts.rsswportalreadyused
msgid "Port already used."
msgid "Port already used"
msgstr ""
#: simplewebsrvstrconsts.rsswsaddress
@ -166,7 +166,7 @@ msgid "Server directory \"%s\" not found."
msgstr ""
#: simplewebsrvstrconsts.rsswserverexecutablenotfound
msgid "Server executable not found."
msgid "Server executable not found"
msgstr ""
#: simplewebsrvstrconsts.rsswserverexecutablenotfoundinpath
@ -175,7 +175,7 @@ msgid "Server executable \"%s\" not found in PATH."
msgstr ""
#: simplewebsrvstrconsts.rsswserverexecutablenotfoundinpath2
msgid "Server executable not found in PATH."
msgid "Server executable not found in PATH"
msgstr ""
#: simplewebsrvstrconsts.rsswserverexeisnotexecutable
@ -184,7 +184,7 @@ msgid "Server exe is not executable: \"%s\""
msgstr ""
#: simplewebsrvstrconsts.rsswserverexeisnotexecutable2
msgid "Server exe is not executable."
msgid "Server exe is not executable"
msgstr ""
#: simplewebsrvstrconsts.rsswserverextracommandlineoptionsoneperline
@ -228,13 +228,18 @@ msgid "User"
msgstr ""
#: simplewebsrvstrconsts.rsswtcpport102465535youcanusemacroportforbelowparams
msgid "TCP Port 1024..65535 (you can use macro $(port) for below params)"
msgid "TCP Port 1024..65535, you can use macro $(Port) for below params"
msgstr ""
#: simplewebsrvstrconsts.rsswthefollowingprocessalreadylistens
msgid "The following process already listens:"
msgstr ""
#: simplewebsrvstrconsts.rsswthereisalreadyaserveronportoriginpath
#, object-pascal-format
msgid "There is already a server on port %s:%sOrigin: %sPath: %s"
msgstr ""
#: simplewebsrvstrconsts.rsswtoolsoptionssimplewebserverbrowser
msgid "Tools / Options / Simple Web Server / Browser"
msgstr ""

View File

@ -36,7 +36,9 @@ msgid "Binding of socket failed"
msgstr "Не удалось привязать сокет"
#: simplewebsrvstrconsts.rsswbrowsertoopenhtmlpagemacroswsbrowser
msgid "Browser to open HTML page (macro $(SWSBrowser))"
#, fuzzy
#| msgid "Browser to open HTML page (macro $(SWSBrowser))"
msgid "Browser to open HTML page, macro $(SWSBrowser)"
msgstr "Браузер для открытия страницы HTML (макрос $(SWSBrowser))"
#: simplewebsrvstrconsts.rsswcannotfindbrowsersee
@ -62,7 +64,9 @@ msgid "Delete server at \"%s\"?"
msgstr "Удалить сервер, расположенный в \"%s\"?"
#: simplewebsrvstrconsts.rsswdirectorynotfound
msgid "Directory not found."
#, fuzzy
#| msgid "Directory not found."
msgid "Directory not found"
msgstr "Каталог не найден."
#: simplewebsrvstrconsts.rsswerror
@ -70,8 +74,9 @@ msgid "Error"
msgstr "Ошибка"
#: simplewebsrvstrconsts.rsswerrorcheckingwhichprocessusestcpport
#, object-pascal-format
msgid "Error checking which process uses TCP port %s:"
#, object-pascal-format, fuzzy
#| msgid "Error checking which process uses TCP port %s:"
msgid "Error checking which process uses TCP port %s"
msgstr "Ошибка при поиске процесса, использующего порт %s:"
#: simplewebsrvstrconsts.rsswerrorcreatingdirectory
@ -83,13 +88,15 @@ msgid "Error finding free TCP port:"
msgstr "Ошибка при поиске свободного порта TCP:"
#: simplewebsrvstrconsts.rsswerrorkillingprocess
#, object-pascal-format
msgid "Error killing process %s:"
#, object-pascal-format, fuzzy
#| msgid "Error killing process %s:"
msgid "Error killing process %s"
msgstr "Ошибка при принудительном завершении процесса %s:"
#: simplewebsrvstrconsts.rsswerrorwriting
#, object-pascal-format
msgid "Error writing \"%s\":"
#, object-pascal-format, fuzzy
#| msgid "Error writing \"%s\":"
msgid "Error writing \"%s\""
msgstr "Ошибка при записи \"%s\":"
#: simplewebsrvstrconsts.rsswexecutable
@ -106,7 +113,9 @@ msgid "Invalid macro. See"
msgstr "Некорректный макрос. Смотрите"
#: simplewebsrvstrconsts.rsswinvalidport
msgid "Invalid Port."
#, fuzzy
#| msgid "Invalid Port."
msgid "Invalid Port"
msgstr "Некорректный порт."
#: simplewebsrvstrconsts.rsswkillpid
@ -131,7 +140,9 @@ msgid "Location"
msgstr "Расположение"
#: simplewebsrvstrconsts.rsswlocationalreadyused
msgid "Location already used."
#, fuzzy
#| msgid "Location already used."
msgid "Location already used"
msgstr "Расположение уже используется."
#: simplewebsrvstrconsts.rsswmissingcontroller
@ -139,23 +150,33 @@ msgid "missing controller"
msgstr "отсутствует контроллер"
#: simplewebsrvstrconsts.rsswmissinglocaldirectory
msgid "Missing local directory."
#, fuzzy
#| msgid "Missing local directory."
msgid "Missing local directory"
msgstr "Отсутствует локальный каталог."
#: simplewebsrvstrconsts.rsswmissinglocation
msgid "Missing Location."
#, fuzzy
#| msgid "Missing Location."
msgid "Missing Location"
msgstr "Отсутствует расположение."
#: simplewebsrvstrconsts.rsswmissingserverexecutable
msgid "Missing server executable."
#, fuzzy
#| msgid "Missing server executable."
msgid "Missing server executable"
msgstr "Отсутствует исполнимый файл сервера."
#: simplewebsrvstrconsts.rsswparameterspleaseusemacroport
msgid "Parameters (please use macro $(port))"
#, fuzzy
#| msgid "Parameters (please use macro $(port))"
msgid "Parameters, please use macro $(port)"
msgstr "Параметры (используйте макрос $(port))"
#: simplewebsrvstrconsts.rsswportalreadyused
msgid "Port already used."
#, fuzzy
#| msgid "Port already used."
msgid "Port already used"
msgstr "Порт уже используется."
#: simplewebsrvstrconsts.rsswsaddress
@ -176,7 +197,9 @@ msgid "Server directory \"%s\" not found."
msgstr "Каталог сервера \"%s\" не найден."
#: simplewebsrvstrconsts.rsswserverexecutablenotfound
msgid "Server executable not found."
#, fuzzy
#| msgid "Server executable not found."
msgid "Server executable not found"
msgstr "Исполнимый файл сервера не найден."
#: simplewebsrvstrconsts.rsswserverexecutablenotfoundinpath
@ -185,7 +208,9 @@ msgid "Server executable \"%s\" not found in PATH."
msgstr "Исполнимый файл сервера \"%s\" не найден в PATH."
#: simplewebsrvstrconsts.rsswserverexecutablenotfoundinpath2
msgid "Server executable not found in PATH."
#, fuzzy
#| msgid "Server executable not found in PATH."
msgid "Server executable not found in PATH"
msgstr "Исполнимый файл сервера не найден в PATH."
#: simplewebsrvstrconsts.rsswserverexeisnotexecutable
@ -194,7 +219,9 @@ msgid "Server exe is not executable: \"%s\""
msgstr "Файл сервера не является исполнимым: \"%s\""
#: simplewebsrvstrconsts.rsswserverexeisnotexecutable2
msgid "Server exe is not executable."
#, fuzzy
#| msgid "Server exe is not executable."
msgid "Server exe is not executable"
msgstr "Файл сервера не является исполнимым."
#: simplewebsrvstrconsts.rsswserverextracommandlineoptionsoneperline
@ -238,13 +265,20 @@ msgid "User"
msgstr "Пользователь"
#: simplewebsrvstrconsts.rsswtcpport102465535youcanusemacroportforbelowparams
msgid "TCP Port 1024..65535 (you can use macro $(port) for below params)"
#, fuzzy
#| msgid "TCP Port 1024..65535 (you can use macro $(port) for below params)"
msgid "TCP Port 1024..65535, you can use macro $(Port) for below params"
msgstr "Порт TCP из диапазона 1024..65535 (можно использовать макрос $(port) в параметрах ниже)"
#: simplewebsrvstrconsts.rsswthefollowingprocessalreadylistens
msgid "The following process already listens:"
msgstr "Его уже занял следующий процесс:"
#: simplewebsrvstrconsts.rsswthereisalreadyaserveronportoriginpath
#, object-pascal-format
msgid "There is already a server on port %s:%sOrigin: %sPath: %s"
msgstr ""
#: simplewebsrvstrconsts.rsswtoolsoptionssimplewebserverbrowser
msgid "Tools / Options / Simple Web Server / Browser"
msgstr "Сервис / Параметры / Простой веб-сервер / Браузер"

View File

@ -1235,6 +1235,15 @@ begin
for i:=0 to 15 do
FAPIKey:=FAPIKey+HexStr(PByte(@SecretGUID)[i],2);
if not ForceDirectoriesUTF8(PathUsed) then
begin
ErrMsg:=rsSWErrorCreatingDirectory+' "'+PathUsed+'"';
AddIDEMessageInfo('20220414180151',ErrMsg);
if Interactive then
ErrDlg(rsSWError, ErrMsg, false);
exit;
end;
FMainSrvInstance.Params.Free;
FMainSrvInstance.Params:=TStringListUTF8Fast.Create;
FMainSrvInstance.Params.Add('-c');
@ -1251,7 +1260,7 @@ begin
begin
if Options.ServerExe<>ExeUsed then
ErrMsg:=ErrMsg+'. Path="'+ExeUsed+'"';
debugln(['Error: [TSimpleWebServerController.StartServerInstance] invalid ServerExe="',Options.ServerExe,'". ',ErrMsg]);
debugln(['Error: [TSimpleWebServerController.StartServerInstance] invalid ServerExe="',Options.ServerExe,'".']);
AddIDEMessageInfo('20220118164525',ErrMsg);
if Interactive then
ErrDlg(rsSWError, Format(rsSWWrongCompileserverExe, [ErrMsg]), true);
@ -1623,10 +1632,10 @@ begin
r:=mrRetry
else
r:=IDEQuestionDialog(rsSWError,
'There is already a server on port '+IntToStr(Port)+':'+sLineBreak
+'Origin: '+ConflictServer.Origin+sLineBreak
+'Path: '+ConflictServer.Path+sLineBreak,
mtError,[mrYes, 'Stop server', mrRetry, rsSWTryAnotherPort, mrCancel],
Format(rsSWThereIsAlreadyAServerOnPortOriginPath, [IntToStr(Port),
sLineBreak, ConflictServer.Origin+sLineBreak, ConflictServer.Path+
sLineBreak]),
mtError,[mrYes, rsSWStopServer, mrRetry, rsSWTryAnotherPort, mrCancel],
'');
case r of
mrYes:

View File

@ -10,17 +10,17 @@ resourcestring
rsSWSAddress = 'Address';
rsSWSPort = 'Port';
rsSWTCPPort102465535YouCanUseMacroPortForBelowParams = 'TCP Port 1024..65535'
+' (you can use macro $(port) for below params)';
+', you can use macro $(Port) for below params';
rsSWExecutable = 'Executable';
rsSWWorkingDirectory = 'Working Directory';
rsSWParametersPleaseUseMacroPort = 'Parameters (please use macro $(port))';
rsSWParametersPleaseUseMacroPort = 'Parameters, please use macro $(port)';
rsSWCommandLineParameters = 'Command line parameters';
rsSWAddCustomServer = 'Add Custom Server';
rsSWSelectDirectory = 'Select Directory';
rsSWServerExtraCommandLineOptionsOnePerLine = 'Server extra command-line '
+'options (one per line)';
rsSWBrowserToOpenHTMLPageMacroSWSBrowser = 'Browser to open HTML page (macro'
+' $(SWSBrowser))';
rsSWBrowserToOpenHTMLPageMacroSWSBrowser = 'Browser to open HTML page, macro'
+' $(SWSBrowser)';
rsSWAddExtraCommandLineOptionsForTheCommandWhichStarts = 'Add extra command-'
+'line options for the command which starts the webserver.';
rsSWUseThisBrowserWhenOpeningTheURLOrHTMLFileOfAWebBro = 'Use this browser '
@ -29,7 +29,7 @@ resourcestring
rsSWSUserOrigin = 'User';
rsSWUnableToAddLocation = 'Unable to add location:';
rsSWMissingController = 'missing controller';
rsSWMissingLocation = 'Missing Location.';
rsSWMissingLocation = 'Missing Location';
rsSWAddSimpleWebServerLocation = 'Add Simple Web Server Location';
rsSWLocation = 'Location';
rsSWAnArbitraryNameForTheURLSubfolder = 'An arbitrary name for the URL '
@ -39,23 +39,25 @@ resourcestring
+'on disk, usually where the server fetches files from';
rsSWAddLocation = 'Add Location';
rsSWError = 'Error';
rsSWThereIsAlreadyAServerOnPortOriginPath = 'There is already a server on '
+'port %s:%sOrigin: %sPath: %s';
rsSWErrorFindingFreeTCPPort = 'Error finding free TCP port:';
rsSWErrorKillingProcess = 'Error killing process %s:';
rsSWErrorKillingProcess = 'Error killing process %s';
rsSWErrorCheckingWhichProcessUsesTCPPort = 'Error checking which process '
+'uses TCP port %s:';
+'uses TCP port %s';
rsSWCannotFindBrowserSee = 'Cannot find browser. See';
rsSWInvalidMacroSee = 'Invalid macro. See';
rsSWToolsOptionsSimpleWebServerBrowser = 'Tools / Options / Simple Web '
+'Server / Browser';
rsSWServerExecutableNotFound = 'Server executable not found.';
rsSWServerExeIsNotExecutable2 = 'Server exe is not executable.';
rsSWInvalidPort = 'Invalid Port.';
rsSWPortAlreadyUsed = 'Port already used.';
rsSWServerExecutableNotFound = 'Server executable not found';
rsSWServerExeIsNotExecutable2 = 'Server exe is not executable';
rsSWInvalidPort = 'Invalid Port';
rsSWPortAlreadyUsed = 'Port already used';
rsSWLocalDirectoryNotFound = 'Local directory not found:';
rsSWLocationAlreadyUsed = 'Location already used.';
rsSWErrorWriting = 'Error writing "%s":';
rsSWLocationAlreadyUsed = 'Location already used';
rsSWErrorWriting = 'Error writing "%s"';
rsSWErrorCreatingDirectory = 'Error creating directory';
rsSWDirectoryNotFound = 'Directory not found.';
rsSWDirectoryNotFound = 'Directory not found';
rsSWSimpleWebServerAddress = 'Simple Web Server Address';
rsSWSimpleWebServerPort = 'Simple Web Server Port';
rsSWSimpleWebServerExecutable = 'Simple Web Server Executable';
@ -71,9 +73,9 @@ resourcestring
rsSWKillProcess = 'Kill process?';
rsSWKillPID = 'Kill PID %s';
rsSWTryAnotherPort = 'Try another port';
rsSWMissingServerExecutable = 'Missing server executable.';
rsSWServerExecutableNotFoundInPATH2 = 'Server executable not found in PATH.';
rsSWMissingLocalDirectory = 'Missing local directory.';
rsSWMissingServerExecutable = 'Missing server executable';
rsSWServerExecutableNotFoundInPATH2 = 'Server executable not found in PATH';
rsSWMissingLocalDirectory = 'Missing local directory';
rsSWStartServer = 'Start Server';
rsSWStopServer = 'Stop Server';
rsSWDelete = 'Delete?';