diff --git a/arangod/V8Server/ApplicationV8.cpp b/arangod/V8Server/ApplicationV8.cpp index 9e94e63ba4..10a5abd155 100644 --- a/arangod/V8Server/ApplicationV8.cpp +++ b/arangod/V8Server/ApplicationV8.cpp @@ -608,43 +608,11 @@ bool ApplicationV8::prepare () { LOGGER_INFO("JavaScript using " << StringUtils::join(paths, ", ")); } - // check whether app-paths exist - if (! _appPath.empty()) { - if (! FileUtils::isDirectory(_appPath.c_str())) { - LOGGER_ERROR("specified app-path '" << _appPath << "' does not exist."); - // TODO: decide if we want to abort server start here - } - else { - const string databasesPath = _appPath + TRI_DIR_SEPARATOR_CHAR + "databases"; - - if (! FileUtils::isDirectory(databasesPath.c_str())) { - LOGGER_ERROR("required app-path sub-directory '" << databasesPath << "' does not exist."); - } - - const string systemPath = _appPath + TRI_DIR_SEPARATOR_CHAR + "system"; - if (! FileUtils::isDirectory(systemPath.c_str())) { - LOGGER_ERROR("required app-path sub-directory '" << systemPath << "' does not exist."); - } - } - } - else { + // check whether app-path was specified + if (_appPath.empty()) { LOGGER_FATAL_AND_EXIT("no value has been specified for --javascript.app-path."); } - if (! _devAppPath.empty()) { - if (! _performUpgrade && ! FileUtils::isDirectory(_devAppPath.c_str())) { - LOGGER_ERROR("specified dev-app-path '" << _devAppPath << "' does not exist."); - // TODO: decide if we want to abort server start here - } - else { - const string databasesPath = _devAppPath + TRI_DIR_SEPARATOR_CHAR + "databases"; - - if (! _performUpgrade && ! FileUtils::isDirectory(databasesPath.c_str())) { - LOGGER_ERROR("required dev-app-path sub-directory '" << databasesPath << "' does not exist."); - } - } - } - if (_packagePath.empty()) { LOGGER_ERROR("--javascript.package-path option was not specified. this may cause follow-up errors."); // TODO: decide if we want to abort server start here diff --git a/arangod/VocBase/server.c b/arangod/VocBase/server.c index 59f23aae4c..8dab2c15b5 100644 --- a/arangod/VocBase/server.c +++ b/arangod/VocBase/server.c @@ -1844,7 +1844,48 @@ int TRI_StartServer (TRI_server_t* server, // ............................................................................. // create shared application directories // ............................................................................. - + + if (server->_appPath != NULL && + strlen(server->_appPath) > 0 && + ! TRI_IsDirectory(server->_appPath)) { + if (! isUpgrade) { + LOG_ERROR("specified --javascript.app-path directory '%s' does not exist. " + "Please start again with --upgrade option to create it.", + server->_appPath); + return TRI_ERROR_BAD_PARAMETER; + } + + res = TRI_CreateDirectory(server->_appPath); + + if (res != TRI_ERROR_NO_ERROR) { + LOG_ERROR("unable to create --javascript.app-path directory '%s': %s", + server->_appPath, + TRI_errno_string(res)); + return res; + } + } + + if (server->_devAppPath != NULL && + strlen(server->_devAppPath) > 0 && + ! TRI_IsDirectory(server->_devAppPath)) { + if (! isUpgrade) { + LOG_ERROR("specified --javascript.dev-app-path directory '%s' does not exist. " + "Please start again with --upgrade option to create it.", + server->_devAppPath); + return TRI_ERROR_BAD_PARAMETER; + } + + res = TRI_CreateDirectory(server->_devAppPath); + + if (res != TRI_ERROR_NO_ERROR) { + LOG_ERROR("unable to create --javascript.dev-app-path directory '%s': %s", + server->_devAppPath, + TRI_errno_string(res)); + return res; + } + } + + // create subdirectories if not yet present res = CreateBaseApplicationDirectory(server->_appPath, "databases"); if (res == TRI_ERROR_NO_ERROR) {