[Bf-committers] system() with spaces

Tony Agee tonyagee at cox.net
Sat Nov 18 22:53:22 CET 2006


Presumably you want to run something like:

C:\some path\command -someswitch c:\some parm path\someparm.ftype ?

That would need to look like:

"c:\some path\command" -someswitch "c:\parm path\someparm.ftype"

-----Original Message-----
From: bf-committers-bounces at projects.blender.org
[mailto:bf-committers-bounces at projects.blender.org] On Behalf Of Alexander
Ewering
Sent: Saturday, November 18, 2006 1:57 PM
To: bf-blender developers
Subject: Re: [Bf-committers] system() with spaces


On Sat, 18 Nov 2006, [ISO-8859-1] Mathias Panzenbvck wrote:

> This should work in most cases under linux, but what if there is a $ or "
in 
> the filename?
> This is very unlikely, but possible.
>
> In python 2.5 I would write a escape function:
>
> def escape(s):
> 	return "'%s'" % ''.join(c if c != "'" else "'\\''" for c in s)
>
> But in C this is a lot harder.

Well, the problem would not be to write an escape function, the problem
is HOW to escape correctly. I could have sworn that command names (with
their paths) can be quoted on win32, as I've seen that in "Properties.."
dialogs from desktop links, for example.. but appearently, I'm wrong..

If nobody can say anything about this matter, I'll rollback the change...

| alexander ewering              instinctive mediaworks
| xx-mail.com/instinctive     http://www.instinctive.de



More information about the Bf-committers mailing list