SEARCH-605

- Review comments fix
This commit is contained in:
Keerthi Niranjan 2018-02-16 13:32:50 +05:30
parent a71a62720d
commit 48fe7a6fbe
2 changed files with 10 additions and 7 deletions

View File

@ -57,7 +57,10 @@ const searchConfig = {
LIBRARY_CONSTANTS: libraryPaths,
FOLDERS_CONSTANTS: folderPaths,
TAR_LZ4_EXT: '.tar.lz4',
MINIMUM_DISK_SPACE: 300000000 // in bytes
MINIMUM_DISK_SPACE: 300000000, // in bytes
PERMISSION_ERROR: "The FSUTIL utility requires that you have administrative privileges.",
WIN_PATH_ERROR: "Error: The system cannot find the path specified.",
MAC_PATH_ERROR: "No such file or directory"
};
module.exports = searchConfig;

View File

@ -11,8 +11,8 @@ function checkDiskSpace(path, resolve, reject) {
if (isMac) {
exec("df -k '" + path.replace(/'/g,"'\\''") + "'", (error, stdout, stderr) => {
if (error) {
if (stderr.indexOf("No such file or directory") !== -1) {
return reject(new Error("No such file or directory : " + error))
if (stderr.indexOf(searchConfig.MAC_PATH_ERROR) !== -1) {
return reject(new Error(`${searchConfig.MAC_PATH_ERROR} ${error}`))
}
return reject(new Error("Error : " + error));
}
@ -27,16 +27,16 @@ function checkDiskSpace(path, resolve, reject) {
} else {
exec(`fsutil volume diskfree ${path}`, (error, stdout) => {
if (error) {
if (stdout.indexOf("Error: The system cannot find the path specified.") !== -1) {
return reject(new Error("No such file or directory : " + error));
if (stdout.indexOf(searchConfig.WIN_PATH_ERROR) !== -1) {
return reject(new Error(`${searchConfig.WIN_PATH_ERROR} ${error}`));
}
if (stdout.indexOf("The FSUTIL utility requires that you have administrative privileges.") !== -1) {
if (stdout.indexOf(searchConfig.PERMISSION_ERROR) !== -1) {
// this is temporary until we use the custom exe file.
return resolve(true);
}
return reject(new Error("Error : " + error));
}
if (stdout.indexOf("The FSUTIL utility requires that you have administrative privileges.") !== -1) {
if (stdout.indexOf(searchConfig.PERMISSION_ERROR) !== -1) {
// this is temporary until we use the custom exe file.
return resolve(true);
}