/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
*/

var argscheck = require('cordova/argscheck'),
    DirectoryEntry = require('./DirectoryEntry'),
    FileEntry = require('./FileEntry'),
    FileError = require('./FileError'),
    exec = require('cordova/exec'),
    privateModule = require('xFace/privateModule'),
    workspace = require('xFace/workspace');

/**
 * Look up file system Entry referred to by local URI.
 * @param {DOMString} uri  URI referring to a local file or directory
 * @param successCallback  invoked with Entry object corresponding to URI
 * @param errorCallback    invoked if error occurs retrieving file system entry
 */
module.exports = function(uri, successCallback, errorCallback) {
    argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
    // error callback
    var fail = function(error) {
        errorCallback && errorCallback(new FileError(error));
    };
    // sanity check for 'not:valid:filename'
    if(!uri || uri.split(":").length > 2) {
        setTimeout( function() {
            fail(FileError.ENCODING_ERR);
        },0);
        return;
    }
    // if successful, return either a file or directory entry
    var success = function(entry) {
        var result;
        if (entry) {
            if (successCallback) {
                result = workspace.checkWorkspace(privateModule.appWorkspace(), entry.fullPath, 'resolveLocalFileSystemURI');
                if (!result) {
                    fail(FileError.SECURITY_ERR);
                }
                else {
                    // create appropriate Entry object
                    result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
                    successCallback(result);
                }
            }
        }
        else {
            // no Entry object returned
            fail(FileError.NOT_FOUND_ERR);
        }
    };

    exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
};

@@ -1021,104 +1021,8 @@
 ec')
-,%0A    privateModule = require('xFace/privateModule'),%0A    workspace = require('xFace/workspace')
 ;%0A%0A/
@@ -1946,260 +1946,8 @@
 ) %7B%0A
-                result = workspace.checkWorkspace(privateModule.appWorkspace(), entry.fullPath, 'resolveLocalFileSystemURI');%0A                if (!result) %7B%0A                    fail(FileError.SECURITY_ERR);%0A                %7D%0A                else %7B%0A    
     
@@ -1993,20 +1993,16 @@
  object%0A
-    
         
@@ -2148,20 +2148,16 @@
         
-    
 successC
@@ -2177,26 +2177,8 @@
 t);%0A
-                %7D%0A
     

Revert "Updated resolveLocalFileSystemURI, if entry.fullPath in not under app workspace, then return SECURITY_ERR"