PureBasic.prefs safety

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

PureBasic.prefs safety

Post by Lunasole »

Just a short story: PB config with all those precious settings was damaged on Purebasic.exe process termination, then it was overwritten after I restarted IDE.

I had no any actual backups of that file. Fortunately WinHex helped to find 3 traces of it in HDD empty space, 2 of them looking actual, so it seems I'll restore my config ^^
(btw Winhex for that is better than most of specialized data recovery programs showing you big fancy button).

Don't know if anyone else lost config in similar conditions (BSOD, power off, process terminated, IDE crash, solar storm, meteorite fall, nuclear attack, ..), but would be nice to have protection against that. Store current prefs in a session DB or something like this.

PS. As well as for other .prefs (especially templates)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PureBasic.prefs safety

Post by RSBasic »

You can remove the write permission for normal user.
Only programs with administrator rights can modify this file.
Or you use the checkbox "Read-only" in file properties.
Or you use a realtime backup software with file versioning, e.g.: http://www.purebasic.fr/german/viewtopi ... 11&t=29256
Image
Image
User avatar
blueb
Addict
Addict
Posts: 1041
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: PureBasic.prefs safety

Post by blueb »

Lunasole wrote: Don't know if anyone else lost config in similar conditions (BSOD, power off, process terminated, IDE crash, solar storm, meteorite fall, nuclear attack, ..), but would be nice to have protection against that. Store current prefs in a session DB or something like this.

PS. As well as for other .prefs (especially templates)
Yes, it has happened to my Main PureBasic pref file.. to combat this I created a small template that I use regularly to store the information in another directory. (especially if I've added procedures to my template file, or changed colors, etc.)

Code: Select all

If CopyDirectory("C:\Users\Bob H\AppData\Roaming\PureBasic", "C:\Latest Home\PureBasic\Bobs Template Backup Folder", "", #PB_FileSystem_Recursive|#PB_FileSystem_Force)

     Debug "Success! You now have a copy of your template files!"

Else
     Debug "+++++++++++++++++++++++++++"
     Debug "+++++++++++++++++++++++++++"
     Debug " Something went wrong! Please try again!"
     Debug "+++++++++++++++++++++++++++"
     Debug "+++++++++++++++++++++++++++"
EndIf
- It was too lonely at the top.

System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: PureBasic.prefs safety

Post by Dude »

Lunasole wrote:Store current prefs in a session DB or something like this
Do you know the Prefs dialog has its own backup and restore feature?
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: PureBasic.prefs safety

Post by Lunasole »

@Dude
It's manual import/export, no any difference with just copying your AppData\Roaming\PureBasic folder

@RSBasic, @blueb
Obvious variants, but just workarounds.
At my first issue with templates (happened long-long ago) I already though to make some launcher (or other stuff) which will do auto-backups and probably finally will code such soon, cause today I really disliked perspective to recreate all the config ^^
In the end all is OK, thanks to NTFS trashing and Winhex, and thanks random it was not a templates file irreversible damage.

Anyway the point is to have such protection internally (like that cool code history feature which saved me lot of times. periodically files added to DB, with dialog to access recorded data from IDE).
I think that's good idea which is easy to implement and which for sure will save some PB coder's mental health in future, lol
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
Post Reply