[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Some path questions
[Thread Prev] | [Thread Next]
- Subject: Some path questions
- From: Admin <admin@xxxxxxxxxx>
- Date: Mon, 5 Aug 2024 20:23:40 +0700
- To: Gambas Mailing List <user@xxxxxxxxxxxxxxxxxxxxxx>
Greetings, guys! Hope you all doing well. So, I have a code: -------------------------- Public Sub UpdateProgram() Dim hClient As HttpClient Dim rMatch As RegExp Dim updatequestion As Integer Dim prgURL, exeName As String prgURL = "http://whatever" exeName = "someprogram.gambas" hClient = New HttpClient As "hClient" hClient.URL = prgURL & exeName hClient.Async = False hClient.Timeout = 10 hClient.Get(, "tmp.gambas") If hClient.Status < 0 Then Return ElseIf Not Exist(Application.Path & "/tmp.gambas") Then message("Due to some black magic the file is not downloaded") rMatch = New RegExp(File.Load(Application.path & "/tmp.gambas"), "Version=(.*)\n")
If rMatch[1].Text = Application.Version Then Try Kill "tmp.gambas" Return Elseupdatequestion = Message.Question("Version " & rMatch[1].Text & " is available", "Update", "Ignore")
If updatequestion = 2 Or updatequestion = 3 Then Try Kill Application.Path & "/tmp.gambas" Return End IfMove Application.Path & "/tmp.gambas" Kill Application.Path & "/" & exeName
Chmod Application.Path & "/" & exeName To "rwxrwxrwx"Message("Version " & rMatch[1].Text & " installed. Please restart program")
Quit End If End If End -----------------------------My question is about Application.Path. Why do I need it? What is the default path without it then. Why is it different for different operators? I mean, why hClient is downloading a file right into the program working directory, which is nice, but then not Exist nor Kill don't see it? Where do they look by default? I mean Exist ("tmp.gambas") is false, yet the file is right there, where hClient has put it. Exist (Application.Path & "/tmp.gambas") is true, as it should, but why so complicated? Maybe I am overcomplicating things.
Dmitry
Re: Some path questions | T Lee Davidson <t.lee.davidson@xxxxxxxxx> |
Re: Some path questions | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
Re: Some path questions | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |