comparison Common/BaseStoragePlugin.cpp @ 20:968eb1c78aed

Added 'RootPath' configuration
author Alain Mazy
date Mon, 07 Sep 2020 14:12:49 +0200
parents 2a02b21f0a19
children 50d0be413c42
comparison
equal deleted inserted replaced
18:44de9edf2443 20:968eb1c78aed
17 17
18 std::string BaseStoragePlugin::GetPath(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) 18 std::string BaseStoragePlugin::GetPath(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled)
19 { 19 {
20 if (enableLegacyStorageStructure_) 20 if (enableLegacyStorageStructure_)
21 { 21 {
22 return GetOrthancFileSystemPath(uuid, std::string()); // there's no "root" path in an object store 22 return GetOrthancFileSystemPath(uuid, rootPath_);
23 } 23 }
24 else 24 else
25 { 25 {
26 std::string path = std::string(uuid); 26 boost::filesystem::path path = rootPath_;
27 std::string filename = std::string(uuid);
27 28
28 if (type == OrthancPluginContentType_Dicom) 29 if (type == OrthancPluginContentType_Dicom)
29 { 30 {
30 path += ".dcm"; 31 filename += ".dcm";
31 } 32 }
32 else if (type == OrthancPluginContentType_DicomAsJson) 33 else if (type == OrthancPluginContentType_DicomAsJson)
33 { 34 {
34 path += ".json"; 35 filename += ".json";
35 } 36 }
36 else 37 else
37 { 38 {
38 path += ".unk"; 39 filename += ".unk";
39 } 40 }
40 41
41 if (encryptionEnabled) 42 if (encryptionEnabled)
42 { 43 {
43 path += ".enc"; 44 filename += ".enc";
44 } 45 }
45 return path; 46 path /= filename;
47
48 return path.string();
46 } 49 }
47 } 50 }
48 51
49 bool BaseStoragePlugin::ReadCommonConfiguration(bool& enableLegacyStorageStructure, const OrthancPlugins::OrthancConfiguration& pluginSection) 52 bool BaseStoragePlugin::ReadCommonConfiguration(bool& enableLegacyStorageStructure, const OrthancPlugins::OrthancConfiguration& pluginSection)
50 { 53 {