/********************************************************************************
 * Copyright (C) 2017 TypeFox and others.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the Eclipse
 * Public License v. 2.0 are satisfied: GNU General Public License, version 2
 * with the GNU Classpath Exception which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 ********************************************************************************/ import { TextDocumentContentChangeEvent } from '@theia/core/shared/vscode-languageserver-protocol' ; import { ApplicationError } from '@theia/core/lib/common' ; deprecated export const FileSystem = Symbol ( 'FileSystem' ) ; export interface FileSystem { deprecated getFileStat ( uri ) : Promise < FileStat | undefined > ; deprecated exists ( uri ) : Promise < boolean > ; deprecated resolveContent ( uri , options ? ) : Promise < { stat : FileStat ; content : string ; } > ; deprecated setContent ( file , content , options ? ) : Promise < FileStat > ; deprecated updateContent ( file , contentChanges , options ? ) : Promise < FileStat > ; deprecated move ( sourceUri , targetUri , options ? ) : Promise < FileStat > ; deprecated copy ( sourceUri , targetUri , options ? ) : Promise < FileStat > ; deprecated createFile ( uri , options ? ) : Promise < FileStat > ; deprecated createFolder ( uri ) : Promise < FileStat > ; /**
     * Creates a new empty file if the given path does not exist and otherwise
     * will set the mtime and atime of the file to the current date.
     */ touchFile ( uri ) : Promise < FileStat > ; deprecated delete ( uri , options ? ) : Promise < void > ; deprecated getEncoding ( uri ) : Promise < string > ; deprecated guessEncoding ( uri ) : Promise < string | undefined > ; /**
     * Return list of available roots.
     */ getRoots ( ) : Promise < FileStat [ ] > ; deprecated getCurrentUserHome ( ) : Promise < FileStat | undefined > ; deprecated getDrives ( ) : Promise < string [ ] > ; deprecated access ( uri , mode ? ) : Promise < boolean > ; deprecated getFsPath ( uri ) : Promise < string | undefined > ; } deprecated export namespace FileAccess { export namespace Constants { /**
         * Flag indicating that the file is visible to the calling process.
         * This is useful for determining if a file exists, but says nothing about rwx permissions. Default if no mode is specified.
         */ export const F_OK = 0 ; /**
         * Flag indicating that the file can be read by the calling process.
         */ export const R_OK = 4 ; /**
         * Flag indicating that the file can be written by the calling process.
         */ export const W_OK = 2 ; /**
         * Flag indicating that the file can be executed by the calling process.
         * This has no effect on Windows (will behave like `FileAccess.F_OK`).
         */ export const X_OK = 1 ; } } export interface FileMoveOptions { overwrite ? : boolean ; } export interface FileDeleteOptions { moveToTrash ? : boolean ; } deprecated export interface FileStat { /**
     * The URI of the file.
     */ uri : string ; /**
     * The last modification of this file.
     */ lastModification : number ; /**
     * `true` if the resource is a directory. Otherwise, `false`.
     */ isDirectory : boolean ; /**
     * The children of the file stat.
     * If it is `undefined` and `isDirectory` is `true`, then this file stat is unresolved.
     */ children ? : FileStat [ ] ; /**
     * The size of the file if known.
     */ size ? : number ; } export namespace FileStat { export function is ( candidate ) { return typeof candidate === 'object' && ( 'uri' in candidate ) && ( 'lastModification' in candidate ) && ( 'isDirectory' in candidate ) ; } export function equals ( one , other ) { if ( ! one || ! other || ! is ( one ) || ! is ( other ) ) { return false ; } return one . uri === other . uri && one . lastModification === other . lastModification && one . isDirectory === other . isDirectory ; } } deprecated export namespace FileSystemError { export const FileNotFound = ApplicationError . declare ( - 33000 , ( uri , prefix ? ) => ( { message : `${ prefix ? prefix + ' ' : '' }'${ uri }' has not been found.` , data : { uri } } ) ) ; export const FileExists = ApplicationError . declare ( - 33001 , ( uri , prefix ? ) => ( { message : `${ prefix ? prefix + ' ' : '' }'${ uri }' already exists.` , data : { uri } } ) ) ; export const FileIsDirectory = ApplicationError . declare ( - 33002 , ( uri , prefix ? ) => ( { message : `${ prefix ? prefix + ' ' : '' }'${ uri }' is a directory.` , data : { uri } } ) ) ; export const FileNotDirectory = ApplicationError . declare ( - 33003 , ( uri , prefix ? ) => ( { message : `${ prefix ? prefix + ' ' : '' }'${ uri }' is not a directory.` , data : { uri } } ) ) ; export const FileIsOutOfSync = ApplicationError . declare ( - 33004 , ( file , stat ) => ( { message : `'${ file . uri }' is out of sync.` , data : { file , stat } } ) ) ; }