Dir for Temp and Runtime Files Set by User

Post Reply
Random Void User
Posts: 22
Joined: 13.07.2024 21:19

Dir for Temp and Runtime Files Set by User

Post 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!
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post 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/.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post by main Alexey »

wait, don't make the patch - I will try it myself.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post 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
Random Void User
Posts: 22
Joined: 13.07.2024 21:19

Re: Dir for Temp and Runtime Files Set by User

Post 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.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post by main Alexey »

FIFOs? first in first out? this is the temp file created by uniqInstance code.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post 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.
Random Void User
Posts: 22
Joined: 13.07.2024 21:19

Re: Dir for Temp and Runtime Files Set by User

Post 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!
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Dir for Temp and Runtime Files Set by User

Post 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.
Post Reply