Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

#5059 chmod all sub files and folders in temp directory #6461

Open
wants to merge 1 commit into from

5 participants

Sriram Jason San Jose Peter Flynn Kevin Dangoor Ingo Richter
Sriram

Programatically set permission to all sub files and folders of temp directory.

Passed Unit test and JsLint

Jason San Jose

Link #5059

Peter Flynn
Owner

@sriram-dev We're in the middle of closing down Sprint 36 this week, so it may be a few more days before we're able to review further pull requests.

Ingo Richter ingorichter was assigned
Sriram

anyone got a chance to look at this one ?

Kevin Dangoor
Owner

@sriram-dev Sorry we haven't gotten to this! @ingorichter: do you think you'll get to this soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 10, 2014
  1. Sriram
This page is out of date. Refresh to see the latest.
Showing with 44 additions and 25 deletions.
  1. +44 −25 test/spec/SpecRunnerUtils.js
69 test/spec/SpecRunnerUtils.js
View
@@ -240,35 +240,54 @@ define(function (require, exports, module) {
}
function _resetPermissionsOnSpecialTempFolders() {
- var i,
- folders = [],
- baseDir = getTempDirectory(),
- promise;
-
- folders.push(baseDir + "/cant_read_here");
- folders.push(baseDir + "/cant_write_here");
-
- promise = Async.doSequentially(folders, function (folder) {
- var deferred = new $.Deferred();
-
- FileSystem.resolve(folder, function (err, entry) {
- if (!err) {
- // Change permissions if the directory exists
- chmod(folder, "777").then(deferred.resolve, deferred.reject);
+ var entries = [],
+ result = new $.Deferred(),
+ promise,
+ entryPromise = new $.Deferred(),
+ tempDir;
+
+ function visitor(entry) {
+ entries.push(entry.fullPath);
+ return true;
+ }
+ tempDir = FileSystem.getDirectoryForPath(getTempDirectory());
+ tempDir.visit(visitor, function(err){
+ if (!err) {
+ entryPromise.resolve(entries);
+ } else {
+ if (err === FileSystemError.NOT_FOUND) {
+ entryPromise.resolve(entries);
} else {
- if (err === FileSystemError.NOT_FOUND) {
- // Resolve the promise since the folder to reset doesn't exist
- deferred.resolve();
+ entryPromise.reject();
+ }
+ }
+ });
+ entryPromise.done(function(entries){
+ promise = Async.doSequentially(entries, function (entry) {
+ var deferred = new $.Deferred();
+
+ FileSystem.resolve(entry, function (err, item) {
+ if (!err) {
+ // Change permissions if the directory exists
+ chmod(entry, "777").then(deferred.resolve, deferred.reject);
} else {
- deferred.reject();
+ if (err === FileSystemError.NOT_FOUND) {
+ // Resolve the promise since the folder to reset doesn't exist
+ deferred.resolve();
+ } else {
+ deferred.reject();
+ }
}
- }
- });
-
- return deferred.promise();
- }, true);
+ });
+
+ return deferred.promise();
+ }, true);
+ promise.then(result.resolve, result.reject);
+ }).fail(function() {
+ result.reject();
+ });
- return promise;
+ return result.promise();
}
/**
Something went wrong with that request. Please try again.