Skip to content

Commit

Permalink
Remove deprecation of permission flags
Browse files Browse the repository at this point in the history
Signed-off-by: Nigel Westbury <[email protected]>
  • Loading branch information
westbury authored and vince-fugnitto committed May 9, 2022
1 parent df80a99 commit cd33db1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/filesystem/src/browser/file-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ export class FileService {

/**
* Tests a user's permissions for the given resource.
* @param resource `URI` of the resource which should be tested.
* @param mode An optional integer that specifies the accessibility checks to be performed.
* Check `FileAccess.Constants` for possible values of mode.
* It is possible to create a mask consisting of the bitwise `OR` of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK).
* If `mode` is not defined, `FileAccess.Constants.F_OK` will be used instead.
*/
async access(resource: URI, mode?: number): Promise<boolean> {
const provider = await this.withProvider(resource);
Expand Down
15 changes: 12 additions & 3 deletions packages/filesystem/src/common/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,16 +698,25 @@ export interface FileSystemProvider {
*/
export interface FileSystemProviderWithAccessCapability extends FileSystemProvider {
/**
* Test if the user has the permission to access the given file in the specified mode.
* Tests a user's permissions for the file or directory specified by URI.
* @param resource The `URI` of the file that should be tested.
* @param mode The access mode that should be tested.
* @param mode An optional integer that specifies the accessibility checks to be performed.
* Check `FileAccess.Constants` for possible values of mode.
* It is possible to create a mask consisting of the bitwise `OR` of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK).
* If `mode` is not defined, `FileAccess.Constants.F_OK` will be used instead.
*
* @returns A promise that resolves if the user has the required permissions, should be rejected otherwise.
*/
access(resource: URI, mode?: number): Promise<void>;

/**
* Derive the platform specific file system path that is represented by the resource.
* Returns the path of the given file URI, specific to the backend's operating system.
* If the URI is not a file URI, undefined is returned.
*
* USE WITH CAUTION: You should always prefer URIs to paths if possible, as they are
* portable and platform independent. Paths should only be used in cases you directly
* interact with the OS, e.g. when running a command on the shell.
*
* @param resource `URI` of the resource to derive the path from.
*
* @returns A promise of the corresponding file system path.
Expand Down
3 changes: 0 additions & 3 deletions packages/filesystem/src/common/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ export interface FileSystem {
getFsPath(uri: string): Promise<string | undefined>
}

/**
* @deprecated since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use `FileService.access` instead
*/
export namespace FileAccess {

export namespace Constants {
Expand Down

0 comments on commit cd33db1

Please sign in to comment.