mirror of https://gitee.com/bigwinds/arangodb
directory creation on startup
This commit is contained in:
parent
b5e9d2e7d4
commit
473a9fca97
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue