diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2011-07-15 22:32:06 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2011-07-15 22:32:06 -0400 |
commit | 2b509383ccb22a1a4258e1d56710cbb998d6c6af (patch) | |
tree | bf970e022fc91e106c63f5d9a0897d87f474f7f8 /indra/llcommon | |
parent | 15c36ee9b39624a29303b6e0cf434c9758657ded (diff) |
Use C++ __FILE__ rather than Python __file__ to find indra work area.
In this case, the Python code in question is being written from a C++ string
literal to a temp script file in a platform-dependent temp directory -- so the
Python __file__ value tells you nothing about the location of the repository
checkout. Embedding __FILE__ from the containing C++ source file works better.
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/tests/llsdserialize_test.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index a54d861680..c65a1d3ca0 100644 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -1674,10 +1674,16 @@ namespace tut struct TestPythonCompatible { TestPythonCompatible(): + // Note the peculiar insertion of __FILE__ into this string. + // Normally I like to make a Python script navigate relative to + // its own placement in the repo directory tree (__file__) -- but + // 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. 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('" __FILE__ "'),\n" " os.pardir, os.pardir, 'lib', 'python'))\n" "try:\n" " from llbase import llsd\n" |