[Gambas-user] Corruption of application.conf with Raspberry Pi

Bruce Steers bsteers4 at gmail.com
Mon Mar 1 07:15:45 CET 2021


sorry i read your question on my phone at work and misread it.

various things can cause default settings load.
difference in exe filename/launching from a link, etc. By default
Settings.class uses the application name if you create a symlink then the
application gets a different name and so does the settings file , to fix
this use an explicit name.
Ie.  make a public variable
*Public mySettings As Settings*

then use...
*mySettings = New Settings(Settings.DefaultDir &/
"myExplicitSettingsFile.conf")*
then search and replace* Settings[ *for *mySettings[ *in your source.
then you are sure to use *myExplicitSettingsFile.conf *every time.

alternatively you could simply import the Settings.class and modify it to
work exactly how you want it to.
I wrote a quick "how to" on importing the gb.settings component here...
https://forum.gambas.one/viewtopic.php?f=6&t=1029
If you do not know how to import gb.settings then that will let you know
how.

you could then add a static *DoNotSave* variable to your Settings.class
file and stop it saving in* Public sub _free()*

Hope that helps

BruceS

On Sun, 28 Feb 2021 at 19:34, Michele V. <akrobaticone at gmail.com> wrote:

> Gambas on raspberry Pi with raspbian
> Sometimes using class gb.setting the file .conf become corrupted and
> default value are loaded
> most likely this happen in case of crash of gambas program
> but i'm not completely sure
> in my gambas application whenever  a value is changed a settings.save
> command is executed
> Raspberry Pi use a SD card and it is very slow in read write operation
> EXT4 with journaling delays writing change on SD card
> Every gambas application write the .conf file whenever is terminated
> I suppose the sum of that condition may cause the problem
> Another question:
> Is possible disable the .conf write at the end of application (specially
> in case of crash)?
>
>
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------
> Io scrivo da UBUNTU GNU/LINUX
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210301/f60030b7/attachment.htm>


More information about the User mailing list