Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
fix bug 6221685
Browse files Browse the repository at this point in the history
  • Loading branch information
jiliang committed Apr 15, 2013
1 parent 88c1050 commit f453b15
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
35 changes: 22 additions & 13 deletions lib/util/sharelibscanner.js
Expand Up @@ -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;
})();

Expand Down
6 changes: 0 additions & 6 deletions 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
4 changes: 1 addition & 3 deletions tmp/README.md
@@ -1,3 +1 @@

#Temp Folder

For write aceess check!

0 comments on commit f453b15

Please sign in to comment.