Page 1 of 1

Dir for Temp and Runtime Files Set by User

Posted: 04.09.2024 19:44
by Random Void User
Folders and files currently scattered across $TMP include "cudatext" and "cudatext_addon_man" directries, and the FIFO "tuniqueinstance_someone_cudatext.0" and "cudatext_download.html" when the user checks for app updates.

I wish CudaText (or FreePascal?) would accept an environment variable (say CUDATEXT_TEMP) holding a directory name for ALL of its runtime/temp files. I would set 'export CUDATEXT_TEMP=/mytemp/cudatext' for example. Or the path could be relative to the cudatext app directory, or depend upon another env var like 'export CUDATEXT_TEMP="${MYTEMPSTUFF}/cudatext"' for example.

A command-line parameter could also work. Many apps offer both, with the command line having highest precedence, then env vars. If I have missed such options, please educate me.

Thanks!

Re: Dir for Temp and Runtime Files Set by User

Posted: 05.09.2024 04:26
by main Alexey
IMO adding CUDATEXT_TEMP var is redundant. no one will it it except maybe you. so better fix the current paths.
let's use one folder temp/cudatext.
most of temp content is created by AddonsManager plugin, so if you know python, you can give the the patch?

files tuniqueinstance* are exception maybe - they are good in temp/.

Re: Dir for Temp and Runtime Files Set by User

Posted: 05.09.2024 04:57
by main Alexey
wait, don't make the patch - I will try it myself.

Re: Dir for Temp and Runtime Files Set by User

Posted: 05.09.2024 05:20
by main Alexey
I updated AddonManager in git.
pls get it from there, and test.
https://github.com/Alexey-T/CudaText/tree/master/app/py

Re: Dir for Temp and Runtime Files Set by User

Posted: 05.09.2024 22:42
by Random Void User
main Alexey wrote: 05.09.2024 04:26 files tuniqueinstance* are exception maybe - they are good in temp/.
FIFOs probably belong in "${XDG_RUNTIME_DIR}/cudatext" on Linux.

Re: Dir for Temp and Runtime Files Set by User

Posted: 06.09.2024 04:18
by main Alexey
FIFOs? first in first out? this is the temp file created by uniqInstance code.

Re: Dir for Temp and Runtime Files Set by User

Posted: 06.09.2024 07:19
by main Alexey
it is OK to create this temp-file in temp-dir - on non-Linux we may not have ${XDG_RUNTIME_DIR} at all.

Re: Dir for Temp and Runtime Files Set by User

Posted: 07.09.2024 17:03
by Random Void User
main Alexey wrote: 06.09.2024 04:18 FIFOs? first in first out? this is the temp file created by uniqInstance code.
I just used 'file' to identify it. I will look at the uniqInstance code later.

Code: Select all

$ file cudatext_unique_myuser_cudatext.0
cudatext_unique_myuser_cudatext.0: fifo (named pipe)
main Alexey wrote: 06.09.2024 07:19 it is OK to create this temp-file in temp-dir - on non-Linux we may not have ${XDG_RUNTIME_DIR} at all.
True enough. Even on Linux there may not be a $TMP environment variable. I had a hard time getting that env var to 'stick' and not disappear for various reasons. I still suggest any 'runtime' files live in a subdirectory of their own, like $TMP/cudatext/runtime/cudatext_unique_myuser_cudatext.0

Thanks!

Re: Dir for Temp and Runtime Files Set by User

Posted: 07.09.2024 18:47
by main Alexey
i fear that using of Temp-dir for uniqInstance is hardcoded in TSimpleIPCServer component in the FPC folder. i did not find any places where temp-dir is used in uniqInstance.