Page 2 of 2

Re: Which directory should I choose to store data files created in my application?

Posted: Sat Jul 22, 2023 1:10 pm
by AZJIO
RegularExpression adds 150kb to your program. You can use the StringField function.

Code: Select all

StringField(StringToCheck , wordnum, "-")
You can also get the path this way

Code: Select all

; https://www.purebasic.fr/english/viewtopic.php?f=12&t=56204
XIncludeFile "Registry.pbi"
UseModule Registry
Debug ReadValue(#HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "AppData")
Debug ReadValue(#HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "AppData")
But you need to fix Registry.pbi. Look here in the "Include" folder

Re: Which directory should I choose to store data files created in my application?

Posted: Sat Jul 22, 2023 1:51 pm
by Marc56us
Program data should be placed in %LocalAppData%.

If the program is to be used on a network (from another machine or even locally), program data should be put in %AppData% (which corresponds to Roaming (as for telephones from abroad)

User data in Home Dir ("Documents")

Code: Select all

Debug "Program Datas (Roaming and local) : " + GetUserDirectory(#PB_Directory_ProgramData)
Debug "Program Local Datas               : " + GetEnvironmentVariable("LOCALAPPDATA")
Debug "User documents                    : " + GetUserDirectory(#PB_Directory_Documents)
To find out the variable mapping (GetEnvironmentVariable("?")), type SET in the console

But of course you can do as you please and let the user take care of the backups... :mrgreen:

:wink:

Re: Which directory should I choose to store data files created in my application?

Posted: Sat Jul 22, 2023 2:10 pm
by Jan2004
Information about %LocalAppData% I found at https://answers.microsoft.com/en-us/win ... 0d4a2f489a

"Program data is a protected system folder which contains all data and configuration of the programs that your PC has, the purpose is keeping safe that data and avoid possible risks to delete it. ProgramData focuses on storing all the generic information of the applications, information that all users can access by default. For example Antivirus will save your database and settings in this directory, this folder can be found in the dirve C:\ or you can enter %programdata% in the address bar of the Windows Explorer."

Now I need some time to carefully analyze the given codes and to check the operations on different versions of Windows - I have XP, 7, 10.

Re: Which directory should I choose to store data files created in my application?

Posted: Sun Jul 23, 2023 9:07 am
by mk-soft
Perhaps with this PathHelper ... All OS

Module PathHelper

Re: Which directory should I choose to store data files created in my application?

Posted: Sun Jul 23, 2023 2:27 pm
by Jan2004
mk-soft, I included your code for in-depth analysis. In connection with the issue I raised in the topic, I now have some material to analyze.