diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-03 17:34:40 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-11-03 20:24:28 -0500 |
commit | 7378043546f1a4b3dc89cdce648bc4c4ef067525 (patch) | |
tree | cbfec9b02a9e376112837256fd82ba969f56c42b /unotest | |
parent | b68a0f659500c2db86aa99df78bac292e3e93d79 (diff) |
unottest: add get(URL|Path)FromWorkdir to locate $WORKDIR_FOR_BUILD
Change-Id: Iec4e609e023262f357a7552b75863aeae9385205
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/inc/unotest/bootstrapfixturebase.hxx | 8 | ||||
-rw-r--r-- | unotest/source/cpp/bootstrapfixturebase.cxx | 27 |
2 files changed, 35 insertions, 0 deletions
diff --git a/unotest/inc/unotest/bootstrapfixturebase.hxx b/unotest/inc/unotest/bootstrapfixturebase.hxx index 085d014c1b1a..740799937907 100644 --- a/unotest/inc/unotest/bootstrapfixturebase.hxx +++ b/unotest/inc/unotest/bootstrapfixturebase.hxx @@ -57,6 +57,8 @@ protected: ::rtl::OUString m_aSrcRootPath; ::rtl::OUString m_aSolverRootURL; ::rtl::OUString m_aSolverRootPath; + ::rtl::OUString m_aWorkdirRootURL; + ::rtl::OUString m_aWorkdirRootPath; com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext; com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory; @@ -80,6 +82,12 @@ public: // return a Path to a given c-str path from the source directory ::rtl::OUString getPathFromSrc( const char *pPath ); + + // return a URL to a given c-str path from the workdir directory + ::rtl::OUString getURLFromWorkdir( const char *pPath ); + + // return a Path to a given c-str path from the workdir directory + ::rtl::OUString getPathFromWorkdir( const char *pPath ); virtual void setUp(); virtual void tearDown(); diff --git a/unotest/source/cpp/bootstrapfixturebase.cxx b/unotest/source/cpp/bootstrapfixturebase.cxx index 42982c27e0a6..90b3c1fb1e01 100644 --- a/unotest/source/cpp/bootstrapfixturebase.cxx +++ b/unotest/source/cpp/bootstrapfixturebase.cxx @@ -50,21 +50,36 @@ test::BootstrapFixtureBase::BootstrapFixtureBase() CPPUNIT_ASSERT_MESSAGE("SRC_ROOT env variable not set", pSrcRoot != NULL && pSrcRoot[0] != 0); const char* pSolverRoot = getenv( "OUTDIR_FOR_BUILD" ); CPPUNIT_ASSERT_MESSAGE("$OUTDIR_FOR_BUILD env variable not set", pSolverRoot != NULL && pSolverRoot[0] != 0); + const char* pWorkdirRoot = getenv( "WORKDIR_FOR_BUILD" ); + CPPUNIT_ASSERT_MESSAGE("$WORKDIR_FOR_BUILD env variable not set", pWorkdirRoot != NULL && pWorkdirRoot[0] != 0); #ifdef WNT if (pSrcRoot[1] == ':') + { m_aSrcRootURL += rtl::OUString::createFromAscii( "/" ); + } if (pSolverRoot[1] == ':') + { m_aSolverRootURL += rtl::OUString::createFromAscii( "/" ); + } + if (pWorkdirRoot[1] == ':') + { + m_aWorkdirRootURL += rtl::OUString::createFromAscii( "/" ); + } #endif #else const char* pSrcRoot = "/assets"; const char* pSolverRoot = "/assets"; + const char* pWorkdirRoot = "/assets"; #endif m_aSrcRootPath = rtl::OUString::createFromAscii( pSrcRoot ); m_aSrcRootURL += m_aSrcRootPath; m_aSolverRootPath = rtl::OUString::createFromAscii( pSolverRoot ); m_aSolverRootURL += m_aSolverRootPath; + + m_aWorkdirRootPath = rtl::OUString::createFromAscii( pWorkdirRoot ); + m_aWorkdirRootURL += m_aWorkdirRootPath; + } test::BootstrapFixtureBase::~BootstrapFixtureBase() @@ -81,6 +96,18 @@ test::BootstrapFixtureBase::~BootstrapFixtureBase() return m_aSrcRootPath + rtl::OUString::createFromAscii( pPath ); } + +::rtl::OUString test::BootstrapFixtureBase::getURLFromWorkdir( const char *pPath ) +{ + return m_aWorkdirRootURL + rtl::OUString::createFromAscii( pPath ); +} + +::rtl::OUString test::BootstrapFixtureBase::getPathFromWorkdir( const char *pPath ) +{ + return m_aWorkdirRootPath + rtl::OUString::createFromAscii( pPath ); + +} + void test::BootstrapFixtureBase::setUp() { // set UserInstallation to user profile dir in test/user-template |