[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some path questions
[Thread Prev] | [Thread Next]
- Subject: Re: Some path questions
- From: Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
- Date: Mon, 12 Aug 2024 12:10:43 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
Le 05/08/2024 à 15:23, Admin a écrit :
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 & "/" & exeNameChmod 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
Files located in your project are reserved, because they will go into the executable file, which is a read-only archive of files.
So you must never write or modify any file in the project directory while running it, because it won't work when you will run your program executable.
Regards, -- Benoît Minisini.
Some path questions | Admin <admin@xxxxxxxxxx> |