|
| Re: About slashes |
 |
Fri, 21 Sep 2007 12:37:45 +000 |
John,
whenever you use a string literal in MAXScript, back slashes are treated
(together with the next character) as special characters for things such
as quotes, tab, newline etc. That makes a back slash a special character
itself, so if you want to use a backslash in a string, use two.
s = "rs\tuv" -- this is the sequence 'r', 's', TAB, 'u', 'v'
but
s = "s\\tu" -- this will create the sequence 's', '\', 't', 'u'
If you are just passing around string values in MAXScript, there will be
no further conversion of backslashes.
s = "c:\\temp\\"
t = s
-- t will still contain the sequence c : \ t e m p \
Note that if you print a string, the backslash codes will be converted.
So printing t from the last example above will produce this:
c:\temp\
And maxfilepath returns a string. So just do this:
p = maxfilepath
makeDir p
and this should all work.
If you want to add to the path, you can do this
p = maxfilepath
p = p + "subdir\\"
makeDir p
You can read more about this in the MXS online help page titled "String
Literals"
For file paths, there is a special convention that forward slashes mean
the same as two back slashes. Therefore some people prefer to write
paths with forward slashes.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|