diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-07-16 10:20:41 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-07-16 10:20:41 -0400 |
commit | 81dc4401288f0a3cb95ce53d4ede79daa0f0f3d0 (patch) | |
tree | 46c4e6fdfcca0d5f27f47c21b3999113e63fae3e /indra/llcommon | |
parent | 2b509383ccb22a1a4258e1d56710cbb998d6c6af (diff) |
Use raw-string syntax for Python string containing Windows pathname.
Consider this pathname for llsdserialize_test.cpp:
C:\nats\indra\llcommon\tests\llsdserialize_test.cpp
Embed that in a Python string literal:
'C:\nats\indra\llcommon\tests\llsdserialize_test.cpp'
and you get a string containing:
C:
ats\indra\llcommon ests\llsdserialize_test.cpp
where the \n became a newline and the \t became a tab character.
Hopefully Python raw-string syntax r'C:\etc\etc' works better.
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/tests/llsdserialize_test.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index c65a1d3ca0..81de64930f 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1680,10 +1680,12 @@ namespace tut // in this case, the script is being written into a platform- // dependent temp directory! So locate indra/lib/python relative // to this C++ source file rather than the Python module. + // Use Python raw-string syntax so Windows pathname backslashes + // won't mislead Python's string scanner. import_llsd("import os.path\n" "import sys\n" "sys.path.insert(0,\n" - " os.path.join(os.path.dirname('" __FILE__ "'),\n" + " os.path.join(os.path.dirname(r'" __FILE__ "'),\n" " os.pardir, os.pardir, 'lib', 'python'))\n" "try:\n" " from llbase import llsd\n" |