[Scripter]

* BUG: Fix issue if use passes '~/...' a relative path as the cache directory on a plugin
This commit is contained in:
Brian G 2021-04-21 17:52:38 -07:00
parent 24ea38d8ef
commit 1a21f8b511
2 changed files with 15 additions and 5 deletions

View file

@ -1,6 +1,7 @@
# Gambas Project File 3.0
Title=gbs3
Startup=ScriptMain
UseTerminal=1
Icon=icon.png
Version=3.15.90
VersionFile=1
@ -8,8 +9,8 @@ Component=gb.eval
Component=gb.pcre
Description="Gambas Script"
Authors="Fabien Bodard, Benoit Minisini, Brian G"
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/AForm"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["-c","-v","-w","~/Scripts/TestSets/TestWebApp.gbs"],["--convert-project","~/Projects/TestPrograms/testerror"],["--convert-project","~/Projects/TestPrograms/testusingtxthighlight","~/Scripts/TestSets"],["-c","-v","~/Scripts/TestSets/testusingtxthighlight.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/TestScripterNoMain"],["-c","-v","-w","~/Scripts/TestGUI.gbs"],["-c","-v","-w","~/Scripts/TestSets/CPU_Test.gbs"],["-c","-v","-w","~/Scripts/TestSets/TestWebPage.gbs"],["-c","-v","-w","--convert-script","~/Scripts/TestSets/CPU_Test.gbs","~/Scripts"],["-c","-v","-w","~/Scripts/CPU_Test"],["-c","-v","-w","-p","~/Scripts/TestPlugin"],["-c","-v","-w","~/Scripts/RunComponent"],["-c","-v","-w","~/Scripts/testshell.gbs"]]
CurrentArgumentList=["-"]
Arguments=[["--help"],["--use","'gb.notify,gb.web'","-e","For i as Integer = 0 To 10:Print \"Hello World\":Next"],["~/bin/who"],["-c","-T","~/bin/mytest"],["-v","TestApp"],["--verbose","TestAppWithMain"],["--verbose","TestLazyApp"],["-c","~/testerror.gbs"],["~/Scripts/TestQuoteAtEnd"],["-c","~/Scripts/AForm"],["-c","-v","-w","~/Scripts/GambasHelpSearch"],["-c","-v","-w","~/Scripts/AMain"],["-c","-v","-w","~/Scripts/gshoutput"],["-c","-v","-w","~/Scripts/TestSets/TestWebApp.gbs"],["--convert-project","~/Projects/TestPrograms/testerror"],["--convert-project","~/Projects/TestPrograms/testusingtxthighlight","~/Scripts/TestSets"],["-c","-v","~/Scripts/TestSets/testusingtxthighlight.gbs"],["-l","library"],["-c","-v","-w","~/Scripts/TestScripterNoMain"],["-c","-v","-w","~/Scripts/TestGUI.gbs"],["-c","-v","-w","~/Scripts/TestSets/CPU_Test.gbs"],["-c","-v","-w","~/Scripts/TestSets/TestWebPage.gbs"],["-c","-v","-w","--convert-script","~/Scripts/TestSets/CPU_Test.gbs","~/Scripts"],["-c","-v","-w","~/Scripts/CPU_Test"],["-c","-v","-w","-p","~/Scripts/TestPlugin","~/myplugins"],["-c","-v","-w","~/Scripts/RunComponent"],["-c","-v","-w","~/Scripts/testshell.gbs"]]
CurrentArgumentList=["-c","-v","-w","-p","~/Scripts/TestPlugin","~/myplugins"]
TabSize=2
Translate=1
Language=en_US

View file

@ -90,6 +90,7 @@ Public Sub ScripterMain(aArgs As String[]) As Integer
CompileError("Unable to create cache directory " & sCacheDir)
Endif
Endif
sCacheDir = File.RealPath(sCacheDir)
Endif
sName = File.Name($sPath)
@ -232,20 +233,28 @@ lExecuteProject:
$sArchivePath = sCacheDir &/ "plugins" &/ $sMd5 &/ sFileName
Try Mkdir sCacheDir &/ "plugins" &/ $sMd5
If Error Then
verbose(Error.text)
Endif
Else
Try Mkdir sCacheDir &/ $sMd5
sFileName = sName
$sArchivePath = sCacheDir &/ $sMd5 &/ sFilename
$sArchivePath = File.RealPath(sCacheDir) &/ $sMd5 &/ sFilename
Endif
Dim ArchiveCmd As String[] = [System.Path &/ "bin/gba" & System.Version, "-o", $sArchivePath, $sPrjPath]
If $oContext.$bVerbose Then ArchiveCmd.Add("-v", 1)
Verbose(ArchiveCmd.Join(" "))
' Remove the old md5 info from directory and delete the old file
If $oContext.$bPlugin And If Exist(sCacheDir &/ sFileName) Then
Endif
Exec ArchiveCmd To sRes
verbose(sRes)
If $oContext.$bPlugin Then
Try Kill sCacheDir &/ sFileName
Try Link $sArchivePath To sCacheDir &/ sFileName
$sExecutable = sCacheDir &/ sFileName
$sStartupClass = ScriptPreProcess["Startup"]