@@ -149,10 +149,11 @@ define(function (require, exports, module) {
149149 * @private
150150 * Creates a document and displays an editor for the specified file path.
151151 * @param {!string } fullPath
152+ * @param {boolean= } silent If true, don't show error message
152153 * @return {$.Promise } a jQuery promise that will be resolved with a
153154 * document for the specified file path, or rejected if the file can not be read.
154155 */
155- function doOpen ( fullPath ) {
156+ function doOpen ( fullPath , silent ) {
156157 var result = new $ . Deferred ( ) ;
157158
158159 if ( ! fullPath ) {
@@ -171,12 +172,18 @@ define(function (require, exports, module) {
171172 result . resolve ( doc ) ;
172173 } )
173174 . fail ( function ( fileError ) {
174- FileUtils . showFileOpenError ( fileError . name , fullPath ) . done ( function ( ) {
175+ function _cleanup ( ) {
175176 // For performance, we do lazy checking of file existence, so it may be in working set
176177 DocumentManager . removeFromWorkingSet ( new NativeFileSystem . FileEntry ( fullPath ) ) ;
177178 EditorManager . focusEditor ( ) ;
178179 result . reject ( ) ;
179- } ) ;
180+ }
181+
182+ if ( silent ) {
183+ _cleanup ( ) ;
184+ } else {
185+ FileUtils . showFileOpenError ( fileError . name , fullPath ) . done ( _cleanup ) ;
186+ }
180187 } ) ;
181188 }
182189
@@ -194,10 +201,11 @@ define(function (require, exports, module) {
194201 * Creates a document and displays an editor for the specified file path.
195202 * If no path is specified, a file prompt is provided for input.
196203 * @param {?string } fullPath - The path of the file to open; if it's null we'll prompt for it
204+ * @param {boolean= } silent - If true, don't show error message
197205 * @return {$.Promise } a jQuery promise that will be resolved with a new
198206 * document for the specified file path, or rejected if the file can not be read.
199207 */
200- function _doOpenWithOptionalPath ( fullPath ) {
208+ function _doOpenWithOptionalPath ( fullPath , silent ) {
201209 var result ;
202210 if ( ! fullPath ) {
203211 // Create placeholder deferred
@@ -219,7 +227,7 @@ define(function (require, exports, module) {
219227 } ) ;
220228 DocumentManager . addListToWorkingSet ( filesToOpen ) ;
221229
222- doOpen ( paths [ paths . length - 1 ] )
230+ doOpen ( paths [ paths . length - 1 ] , silent )
223231 . done ( function ( doc ) {
224232 var url = PathUtils . parseUrl ( doc . file . fullPath ) ;
225233 //reconstruct the url but use the directory and stop there
@@ -235,7 +243,7 @@ define(function (require, exports, module) {
235243 }
236244 } ) ;
237245 } else {
238- result = doOpen ( fullPath ) ;
246+ result = doOpen ( fullPath , silent ) ;
239247 }
240248
241249 return result . promise ( ) ;
@@ -273,8 +281,9 @@ define(function (require, exports, module) {
273281 * lineNumber and columnNumber are 1-origin: the very first line is line 1, and the very first column is column 1.
274282 */
275283 function handleFileOpen ( commandData ) {
276- var fileInfo = _parseDecoratedPath ( commandData ? commandData . fullPath : null ) ;
277- return _doOpenWithOptionalPath ( fileInfo . path )
284+ var fileInfo = _parseDecoratedPath ( commandData ? commandData . fullPath : null ) ,
285+ silent = commandData ? commandData . silent : false ;
286+ return _doOpenWithOptionalPath ( fileInfo . path , silent )
278287 . always ( function ( ) {
279288 // If a line and column number were given, position the editor accordingly.
280289 if ( fileInfo . line !== null ) {
0 commit comments