Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3290)

Unified Diff: chrome/browser/resources/file_manager/common/js/util.js

Issue 148193002: Removed most of path utility functions in Files app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/common/js/util.js
diff --git a/chrome/browser/resources/file_manager/common/js/util.js b/chrome/browser/resources/file_manager/common/js/util.js
index 2fa30ecb437545fbfa7271c029e23893a4e35937..e719550740b22a130f913d9001596eb067b34203 100644
--- a/chrome/browser/resources/file_manager/common/js/util.js
+++ b/chrome/browser/resources/file_manager/common/js/util.js
@@ -317,67 +317,6 @@ util.resolvePath = function(root, path, resultCallback, errorCallback) {
};
/**
- * Locate the file referred to by path, creating directories or the file
- * itself if necessary.
- * @param {DirEntry} root The root entry.
- * @param {string} path The file path.
- * @param {function(FileEntry)} successCallback The callback.
- * @param {function(FileError)} errorCallback The callback.
- */
-util.getOrCreateFile = function(root, path, successCallback, errorCallback) {
- var dirname = null;
- var basename = null;
-
- var onDirFound = function(dirEntry) {
- dirEntry.getFile(basename, { create: true },
- successCallback, errorCallback);
- };
-
- var i = path.lastIndexOf('/');
- if (i > -1) {
- dirname = path.substr(0, i);
- basename = path.substr(i + 1);
- } else {
- basename = path;
- }
-
- if (!dirname) {
- onDirFound(root);
- return;
- }
-
- util.getOrCreateDirectory(root, dirname, onDirFound, errorCallback);
-};
-
-/**
- * Locate the directory referred to by path, creating directories along the
- * way.
- * @param {DirEntry} root The root entry.
- * @param {string} path The directory path.
- * @param {function(FileEntry)} successCallback The callback.
- * @param {function(FileError)} errorCallback The callback.
- */
-util.getOrCreateDirectory = function(root, path, successCallback,
- errorCallback) {
- var names = path.split('/');
-
- var getOrCreateNextName = function(dir) {
- if (!names.length)
- return successCallback(dir);
-
- var name;
- do {
- name = names.shift();
- } while (!name || name == '.');
-
- dir.getDirectory(name, { create: true }, getOrCreateNextName,
- errorCallback);
- };
-
- getOrCreateNextName(root);
-};
-
-/**
* Renames the entry to newName.
* @param {Entry} entry The entry to be renamed.
* @param {string} newName The new name.

Powered by Google App Engine
This is Rietveld 408576698