Chromium Code Reviews| Index: chrome/browser/resources/file_manager/foreground/js/file_manager.js |
| diff --git a/chrome/browser/resources/file_manager/foreground/js/file_manager.js b/chrome/browser/resources/file_manager/foreground/js/file_manager.js |
| index 793d423ca3dff0344211c33ea25473b56e057c88..6ddf9b80615d70537c0ec7d0e42040dda966113e 100644 |
| --- a/chrome/browser/resources/file_manager/foreground/js/file_manager.js |
| +++ b/chrome/browser/resources/file_manager/foreground/js/file_manager.js |
| @@ -1481,7 +1481,7 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; |
| } |
| if (candidateEntry) { |
| - // The entry is directry. Use it. |
| + // The entry is directory. Use it. |
| if (candidateEntry.isDirectory) { |
| nextCurrentDirEntry = candidateEntry; |
| callback(); |
| @@ -1502,19 +1502,40 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; |
| } |
| // If the entry doesn't exist, most probably because the path contains a |
| - // suggested name. Therefore try to open its parent. |
| + // suggested name. Therefore try to open its parent. However, the parent |
| + // may also not exist. In such situation, fallback. |
| var pathNodes = candidateFullPath.split('/'); |
| - suggestedName = pathNodes.pop(); |
| + var baseName = pathNodes.pop(); |
| var parentPath = pathNodes.join('/'); |
| this.volumeManager_.resolveAbsolutePath( |
| parentPath, |
| function(parentEntry) { |
| nextCurrentDirEntry = parentEntry; |
| + suggestedName = baseName; |
| callback(); |
| }, |
| function() { |
|
hirono
2014/01/06 10:20:11
We can pass the callback directly.
mtomasz
2014/01/07 00:52:10
Done.
|
| - error = new Error('Failed to setup an initial directory: ' + |
| - nextCurrentDirPath); |
| + callback(); |
| + }); |
| + }.bind(this)); |
| + |
| + queue.run(function(callback) { |
| + // If the directory is not set at this stage, fallback to the default |
| + // mount point. |
| + if (nextCurrentDirEntry) { |
| + callback(); |
| + return; |
| + } |
| + this.volumeManager_.resolveAbsolutePath( |
| + PathUtil.DEFAULT_MOUNT_POINT, |
| + function(fallbackEntry) { |
| + nextCurrentDirEntry = fallbackEntry; |
| + callback(); |
| + }, |
| + function() { |
| + // Fallback directory not available? Throw an error. |
| + error = new Error('Unable to resolve the fallback directory: ' + |
| + PathUtil.DEFAULT_MOUNT_POINT); |
| callback(); |
| }); |
| }.bind(this)); |