Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
rename back to copyPath()
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsanjose committed Dec 11, 2012
1 parent 1523de8 commit 2e6e053
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/extensions/default/JavaScriptQuickEdit/unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ define(function (require, exports, module) {
removePrefix : true
};

SpecRunnerUtils.copyDirectoryPath(testPath, tempPath, options).done(function () {
SpecRunnerUtils.copyPath(testPath, tempPath, options).done(function () {
spec.infos = infos;
result.resolve();
}).fail(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/InlineEditorProviders-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ define(function (require, exports, module) {
removePrefix : true
};

SpecRunnerUtils.copyDirectoryPath(testPath, tempPath, options).done(function () {
SpecRunnerUtils.copyPath(testPath, tempPath, options).done(function () {
spec.infos = infos;
result.resolve();
}).fail(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/LowLevelFileIO-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ define(function (require, exports, module) {
beforeEach(function () {
runs(function () {
var testFiles = SpecRunnerUtils.getTestPath("/spec/LowLevelFileIO-test-files");
waitsForDone(SpecRunnerUtils.copyDirectoryPath(testFiles, baseDir));
waitsForDone(SpecRunnerUtils.copyPath(testFiles, baseDir));
});

runs(function () {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/NativeFileSystem-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ define(function (require, exports, module) {
runs(function () {
var testFiles = SpecRunnerUtils.getTestPath("/spec/NativeFileSystem-test-files");
self.path = SpecRunnerUtils.getTempDirectory();
waitsForDone(SpecRunnerUtils.copyDirectoryPath(testFiles, self.path));
waitsForDone(SpecRunnerUtils.copyPath(testFiles, self.path));
});

runs(function () {
Expand Down
44 changes: 14 additions & 30 deletions test/spec/SpecRunnerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,29 +542,6 @@ define(function (require, exports, module) {
return deferred.promise();
}

/**
* Copy a file source path to a destination
* @param {!string} source Path for the source file to copy
* @param {!string} destination Destination path to copy the source file
* @param {?{parseOffsets:boolean}} options parseOffsets allows optional
* offset markup parsing. File is written to the destination path
* without offsets. Offset data is passed to the doneCallbacks of the
* promise.
* @return {$.Promise} A promise resolved when the file is copied to the
* destination.
*/
function copyFilePath(source, destination, options) {
var deferred = new $.Deferred();

resolveNativeFileSystemPath(source).done(function (entry) {
copyFileEntry(entry, destination, options).pipe(deferred.resolve, deferred.reject);
}).fail(function () {
deferred.reject();
});

return deferred.promise();
}

/**
* Copy a directory source to a destination
* @param {!DirectoryEntry} source Entry for the source directory to copy
Expand Down Expand Up @@ -651,9 +628,9 @@ define(function (require, exports, module) {
}

/**
* Copy a directory source path to a destination
* @param {!string} source Path for the source directory to copy
* @param {!string} destination Destination path to copy the source directory
* Copy a file or directory source path to a destination
* @param {!string} source Path for the source file or directory to copy
* @param {!string} destination Destination path to copy the source file or directory
* @param {?{parseOffsets:boolean, infos:Object, removePrefix:boolean}}} options
* parseOffsets - allows optional offset markup parsing. File is written to the
* destination path without offsets. Offset data is passed to the
Expand All @@ -667,11 +644,19 @@ define(function (require, exports, module) {
* contents are copied to the destination or rejected immediately
* upon the first error.
*/
function copyDirectoryPath(source, destination, options) {
function copyPath(source, destination, options) {
var deferred = new $.Deferred();

resolveNativeFileSystemPath(source).done(function (entry) {
copyDirectoryEntry(entry, destination, options).pipe(deferred.resolve, deferred.reject);
var promise;

if (entry.isDirectory) {
promise = copyDirectoryEntry(entry, destination, options);
} else {
promise = copyFileEntry(entry, destination, options);
}

promise.pipe(deferred.resolve, deferred.reject);
}).fail(function () {
deferred.reject();
});
Expand Down Expand Up @@ -823,9 +808,8 @@ define(function (require, exports, module) {
exports.toggleQuickEditAtOffset = toggleQuickEditAtOffset;
exports.createTextFile = createTextFile;
exports.copyDirectoryEntry = copyDirectoryEntry;
exports.copyDirectoryPath = copyDirectoryPath;
exports.copyFileEntry = copyFileEntry;
exports.copyFilePath = copyFilePath;
exports.copyPath = copyPath;
exports.deletePath = deletePath;
exports.getTestWindow = getTestWindow;
exports.simulateKeyEvent = simulateKeyEvent;
Expand Down

0 comments on commit 2e6e053

Please sign in to comment.