Backslash bug

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Backslash bug

Milan Babuskov-2
Hi guys,

I just run into a bug. Don't have the time to look into it now, but I
guess it has got something to do with config and backslashes.

I open the database's preferences page, and set this as a log file:

C:\htb\trg\sql\%d.sql

But, when I "save" and reopen the dialog, one backslash is gone.

C:\htb\trg\sql%d.sql

Of course, I noticed too late, so I had to rename a bunch of files. Not
to mention that there were none sql___.sql files in "trg" directory, so
it started from zero instead 276 as it should.

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Backslash bug

Milan Babuskov-5
Milan Babuskov wrote:

> I just run into a bug. Don't have the time to look into it now, but I
> guess it has got something to do with config and backslashes.
>
> I open the database's preferences page, and set this as a log file:
>
> C:\htb\trg\sql\%d.sql
>
> But, when I "save" and reopen the dialog, one backslash is gone.
>
> C:\htb\trg\sql%d.sql

I looks like all strings read/written by config() are affected. I think
I found the reason. I tracked it down to wxConfig. Here's a snippet from
manual that explains it:

-------------- quote ---------------
Some aspects of wxConfigBase behaviour can be changed during run-time.
The first of them is the expansion of environment variables in the
string values read from the config file: for example, if you have the
following in your config file:


   # config file for my program
   UserData = $HOME/data

   # the following syntax is valud only under Windows
   UserData = %windir%\\data.dat

the call to config->Read("UserData") will return something like
"/home/zeitlin/data" if you're lucky enough to run a Linux system ;-)
Although this feature is very useful, it may be annoying if you read a
value which containts '$' or '%' symbols (% is used for environment
variables expansion under Windows) which are not used for environment
variable expansion.
---------- end quote ---------------

Nando, are you relying on env.var. expansion for something? If not, I
think it would be best to disable it completely by calling
SetExpandEnvVars(false) in config's constructor.

I committed that to CVS, but if you do need it for something, feel free
to remove the fix and we'll find some other way (escaping \% with
additional backslash comes to mind).

--
Milan Babuskov
http://fbexport.sourceforge.net
http://www.flamerobin.org



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Backslash bug

Nando Dessena
Milan,

M> Nando, are you relying on env.var. expansion for something?

no, although it could be useful. ;-)

M> If not, I
M> think it would be best to disable it completely by calling
M> SetExpandEnvVars(false) in config's constructor.

for the time being, yes.

Ciao
--
Nando Dessena
http://www.flamerobin.org



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel