diff --git a/lib/util/sharelibscanner.js b/lib/util/sharelibscanner.js index 8b73dfbb..7abdd5b3 100644 --- a/lib/util/sharelibscanner.js +++ b/lib/util/sharelibscanner.js @@ -49,22 +49,31 @@ var custom_controller; * save to /Users/***\/.Arrow/__arrow_hash__/ */ var shareLibMetaPath = (function () { - var metapath = path.join(USERHOME, ".Arrow", calcLibHashByFsPath(ARROW_MODULES_ROOT)); - - function mkpathsync(dirpath, mode) { - dirpath = path.resolve(dirpath); - try { - if (!fs.statSync(dirpath).isDirectory()) { - throw new Error(dirpath + ' exists and is not a directory'); - } - } catch (err) { - if (err.code === 'ENOENT') { - mkpathsync(path.dirname(dirpath), mode); - fs.mkdirSync(dirpath, mode); + // first try arrow/tmp + var metapath = path.join(ARROW_MODULES_ROOT,"tmp"); + try { + fs.writeFileSync(path.join(metapath,"README.md"), "For write aceess check!","utf8"); + } catch (err) { + if (err.code === 'EACCES') { + // no write acess,then make it to HOME/.Arrow/__path_hash__ + metapath = path.join(USERHOME, ".Arrow", calcLibHashByFsPath(ARROW_MODULES_ROOT)); + function mkpathsync(dirpath, mode) { + dirpath = path.resolve(dirpath); + try { + if (!fs.statSync(dirpath).isDirectory()) { + throw new Error(dirpath + ' exists and is not a directory'); + } + } catch (err) { + if (err.code === 'ENOENT') { + mkpathsync(path.dirname(dirpath), mode); + fs.mkdirSync(dirpath, mode); + } + } } + // mkdir -p + mkpathsync(metapath); } } - mkpathsync(metapath); return metapath; })(); diff --git a/tests/functional/data/actual_op/test14.txt b/tests/functional/data/actual_op/test14.txt index fcb4c744..e69de29b 100644 --- a/tests/functional/data/actual_op/test14.txt +++ b/tests/functional/data/actual_op/test14.txt @@ -1,6 +0,0 @@ -Test Report Summary - -Total Number of Executed Tests: 1 -Total Number of Passed Tests: 1 -Total Number of Failed Tests: 0 -Total Number of Skipped Tests: 0 diff --git a/tmp/README.md b/tmp/README.md index ac96fb73..28d741e2 100644 --- a/tmp/README.md +++ b/tmp/README.md @@ -1,3 +1 @@ - -#Temp Folder - +For write aceess check! \ No newline at end of file