8000 fix compilation · mnemosdev/arangodb@d78f7fa · GitHub
[go: up one dir, main page]

Skip to content

Commit d78f7fa

Browse files
committed
fix compilation
1 parent f391771 commit d78f7fa

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

arangod/V8Server/V8DealerFeature.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "V8DealerFeature.h"
2424

25+
#include <regex>
2526
#include <thread>
2627

2728
#include "3rdParty/valgrind/valgrind.h"
@@ -41,6 +42,7 @@
4142
#include "Random/RandomGenerator.h"
4243
#include "RestServer/DatabaseFeature.h"
4344
#include "RestServer/DatabasePathFeature.h"
45+
#include "Rest/Version.h"
4446
#include "Scheduler/JobGuard.h"
4547
#include "Scheduler/SchedulerFeature.h"
4648
#include "Transaction/V8Context.h"
@@ -194,6 +196,27 @@ void V8DealerFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
194196
ctx->normalizePath(_startupDirectory, "javascript.startup-directory", true);
195197
ctx->normalizePath(_moduleDirectory, "javascript.module-directory", false);
196198

199+
// try to append the current version name to the startup directory,
200+
// so instead of "/path/to/js" we will get "/path/to/js/3.4.0"
201+
std::string const versionAppendix = std::regex_replace(rest::Version::getServerVersion(), std::regex("-.*$"), "");
202+
std::string versionedPath = basics::FileUtils::buildFilename(_startupDirectory, versionAppendix);
203+
204+
LOG_TOPIC(DEBUG, Logger::V8) << "checking for existence of version-specific startup-directory '" << versionedPath << "'";
205+
if (basics::FileUtils::isDirectory(versionedPath)) {
206+
// version-specific js path exists!
207+
_startupDirectory = versionedPath;
208+
}
209+
210+
for (auto& it : _moduleDirectory) {
211+
versionedPath = basics::FileUtils::buildFilename(it, versionAppendix);
212+
213+
LOG_TOPIC(DEBUG, Logger::V8) << "checking for existence of version-specific module-directory '" << versionedPath << "'";
214+
if (basics::FileUtils::isDirectory(versionedPath)) {
215+
// version-specific js path exists!
216+
it = versionedPath;
217+
}
218+
}
219+
197220
// check whether app-path was specified
198221
if (_appPath.empty()) {
199222
LOG_TOPIC(FATAL, arangodb::Logger::V8) << "no value has been specified for --javascript.app-path";

0 commit comments

Comments
 (0)
0