Mercurial > hg > orthanc
comparison OrthancServer/OrthancInitialization.cpp @ 87:8517e2c44283
path to configuration
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 26 Sep 2012 17:39:03 +0200 |
parents | a70bb32802ae |
children | 8936a3bbb129 |
comparison
equal
deleted
inserted
replaced
86:de8a5329b069 | 87:8517e2c44283 |
---|---|
43 std::string content; | 43 std::string content; |
44 | 44 |
45 if (configurationFile) | 45 if (configurationFile) |
46 { | 46 { |
47 Toolbox::ReadFile(content, configurationFile); | 47 Toolbox::ReadFile(content, configurationFile); |
48 } | 48 printf("Using the configuration from: [%s]\n", configurationFile); |
49 else | 49 } |
50 { | 50 else |
51 { | |
52 #if ORTHANC_STANDALONE == 1 && defined(__linux) | |
53 // Under Linux, try and open "../etc/orthanc/Configuration.json" | |
51 try | 54 try |
52 { | 55 { |
53 #if ORTHANC_STANDALONE == 0 | 56 boost::filesystem::path p = ORTHANC_PATH; |
57 p = p.parent_path(); | |
58 p /= "etc"; | |
59 p /= "orthanc"; | |
60 p /= CONFIGURATION_FILE; | |
61 | |
62 Toolbox::ReadFile(content, p.string()); | |
63 printf("Using the configuration from: [%s]\n", p.string().c_str()); | |
64 } | |
65 catch (OrthancException&) | |
66 { | |
67 // No configuration file found, give up with empty configuration | |
68 printf("Using the default Orthanc configuration\n"); | |
69 return; | |
70 } | |
71 | |
72 #elif ORTHANC_STANDALONE == 1 | |
73 // No default path for the configuration file in Windows | |
74 printf("Using the default Orthanc configuration\n"); | |
75 return; | |
76 | |
77 #else | |
78 // In a non-standalone build, we use the | |
79 // "Resources/Configuration.json" from the Orthanc distribution | |
80 try | |
81 { | |
54 boost::filesystem::path p = ORTHANC_PATH; | 82 boost::filesystem::path p = ORTHANC_PATH; |
55 p /= "Resources"; | 83 p /= "Resources"; |
56 p /= CONFIGURATION_FILE; | 84 p /= CONFIGURATION_FILE; |
57 Toolbox::ReadFile(content, p.string()); | 85 Toolbox::ReadFile(content, p.string()); |
58 #else | 86 printf("Using the configuration from: [%s]\n", p.string().c_str()); |
59 Toolbox::ReadFile(content, CONFIGURATION_FILE); | 87 } |
88 catch (OrthancException&) | |
89 { | |
90 // No configuration file found, give up with empty configuration | |
91 printf("Using the default Orthanc configuration\n"); | |
92 return; | |
93 } | |
60 #endif | 94 #endif |
61 } | |
62 catch (OrthancException&) | |
63 { | |
64 // No configuration file found, give up with empty configuration | |
65 return; | |
66 } | |
67 } | 95 } |
68 | 96 |
69 Json::Reader reader; | 97 Json::Reader reader; |
70 if (!reader.parse(content, *configuration_)) | 98 if (!reader.parse(content, *configuration_)) |
71 { | 99 { |