From ffc74562f7c3791ef32f92d95b8216874c151ec6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 2 Mar 2011 15:36:02 +0100 Subject: [PATCH] STYLE: shorten paths reported in dynamicCode --- .../dynamicLibrary/dynamicCode/dynamicCode.C | 20 ++++++++++++++++--- .../dynamicLibrary/dynamicCode/dynamicCode.H | 14 +++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index 2493ad8d16..97cf221e7e 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -51,6 +51,8 @@ const Foam::fileName Foam::dynamicCode::codeTemplateDirName const char* Foam::dynamicCode::libTargetRoot = "LIB = $(PWD)/../platforms/$(WM_OPTIONS)/lib/lib"; +const char* Foam::dynamicCode::topDirName = "dynamicCode"; + // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // @@ -281,7 +283,7 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName) : - codeRoot_(stringOps::expand("$FOAM_CASE/dynamicCode")), + codeRoot_(stringOps::expand("$FOAM_CASE")/topDirName), libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")), codeName_(codeName), codeDirName_(codeDirName) @@ -297,6 +299,18 @@ Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::fileName Foam::dynamicCode::codeRelPath() const +{ + return topDirName/codeDirName_; +} + + +Foam::fileName Foam::dynamicCode::libRelPath() const +{ + return codeRelPath()/libSubDir_/"lib" + codeName_ + ".so"; +} + + void Foam::dynamicCode::clear() { compileFiles_.clear(); @@ -376,7 +390,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const { if (verbose) { - Info<< "Creating new library in " << this->libPath() << endl; + Info<< "Creating new library in " << this->libRelPath() << endl; } if (!allowSystemOperations) @@ -500,7 +514,7 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const bool Foam::dynamicCode::wmakeLibso() const { - const Foam::string wmakeCmd("wmake libso " + this->codePath()); + const Foam::string wmakeCmd("wmake libso " + this->codeRelPath()); Info<< "Invoking " << wmakeCmd << endl; if (Foam::system(wmakeCmd)) diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H index af7f996c08..f43cbf691c 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.H @@ -108,6 +108,9 @@ protected: //- Root of the LIB target for Make/files static const char* libTargetRoot; + //- Top-level directory name for copy/compiling + static const char* topDirName; + // Protected Member Functions @@ -220,6 +223,17 @@ public: return codeRoot_/libSubDir_/"lib" + codeName_ + ".so"; } + //- Path for specified code name relative to \$FOAM_CASE + // Corresponds to topDirName/codeDirName() + fileName codeRelPath() const; + + + //- Library path for specified code name relative to \$FOAM_CASE + // Corresponds to + // dynamicCode/codeDirName()/libSubDir()/lib\.so + fileName libRelPath() const; + + //- Path for SHA1Digest // Corresponds to codePath()/Make/SHA1Digest fileName digestFile() const