Commit 8046783c authored by jcfr's avatar jcfr

BUG: Ensure MacOSX package can be renamed from "Slicer.app" to "Something.app"

Fixes #2848

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21566 3bd1e089-480b-0410-8dfb-8563597acbee
parent d983f2b9
......@@ -21,6 +21,7 @@
// Slicer includes
#include "vtkSlicerApplicationLogic.h"
#include "vtkMRMLCoreTestingMacros.h"
#include "vtkSlicerConfigure.h"
// VTK includes
#include <vtkNew.h>
......@@ -129,6 +130,7 @@ int vtkSlicerApplicationLogicTest1(int , char * [])
// The following vector contains rows where each row has three items:
// - filePath
// - applicationHomeDir
// - slicerRevision
// - isEmbeddedExpected
typedef std::vector<std::string> TestRowType;
typedef std::vector< TestRowType > TestDataType;
......@@ -165,6 +167,22 @@ int vtkSlicerApplicationLogicTest1(int , char * [])
row.push_back("0");
data.push_back(row);
}
{
TestRowType row;
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build/bin/" Slicer_BUNDLE_LOCATION "/Extensions-4810/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/vtkSlicerReportingModuleLogic.py");
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build");
row.push_back("4810");
row.push_back("0");
data.push_back(row);
}
{
TestRowType row;
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build/bin/Foo.app/Contents/Extensions-4810/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/vtkSlicerReportingModuleLogic.py");
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build");
row.push_back("4810");
row.push_back("0");
data.push_back(row);
}
{
TestRowType row;
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build/bin/Slicer.app/Contents/Extensions-4810/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/vtkSlicerReportingModuleLogic.py");
......@@ -173,6 +191,22 @@ int vtkSlicerApplicationLogicTest1(int , char * [])
row.push_back("1");
data.push_back(row);
}
{
TestRowType row;
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build/bin/" Slicer_BUNDLE_LOCATION "/Extensions-4810/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/vtkSlicerReportingModuleLogic.py");
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build");
row.push_back("4811");
row.push_back("1");
data.push_back(row);
}
{
TestRowType row;
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build/bin/Foo.app/Contents/Extensions-4810/Reporting/lib/Slicer-4.1/qt-loadable-modules/Python/vtkSlicerReportingModuleLogic.py");
row.push_back("/home/jchris/Projects/Slicer4-Superbuild-Debug/Slicer-build");
row.push_back("4811");
row.push_back("1");
data.push_back(row);
}
for(TestDataType::size_type rowIdx = 0; rowIdx < data.size(); ++rowIdx)
{
std::string filePath(data.at(rowIdx).at(0));
......
......@@ -1567,7 +1567,9 @@ bool vtkSlicerApplicationLogic::IsEmbeddedModule(const std::string& filePath,
// On MacOSX extensions are installed in the "<Slicer_EXTENSIONS_DIRBASENAME>-<slicerRevision>"
// folder being a sub directory of the application dir, an extra test is required to make sure the
// tested filePath doesn't belong to that "<Slicer_EXTENSIONS_DIRBASENAME>-<slicerRevision>" folder.
if (isEmbedded && extensionPath.find(Slicer_BUNDLE_LOCATION "/" Slicer_EXTENSIONS_DIRBASENAME "-" + slicerRevision) != std::string::npos)
// BUG 2848: Since package name can be rename from "Slicer.app" to "Something.app", let's compare
// using ".app/Contents/" instead of "Slicer_BUNDLE_LOCATION" which is "Slicer.app/Contents/"
if (isEmbedded && extensionPath.find(".app/Contents/" Slicer_EXTENSIONS_DIRBASENAME "-" + slicerRevision) != std::string::npos)
{
isEmbedded = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment