Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileSystemProvider: FileOptions is a bit weird to support/understand #48668

Closed
bpasero opened this issue Apr 25, 2018 · 3 comments
Closed

FileSystemProvider: FileOptions is a bit weird to support/understand #48668

bpasero opened this issue Apr 25, 2018 · 3 comments
Assignees
Labels
remote Remote system operations issues verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Apr 25, 2018

Refs: #48421

Today vscode.FileOptions is this:

export interface FileOptions {

	/**
	 * Create a file when it doesn't exists
	 */
	create?: boolean;

	/**
	 * In combination with [`create`](FileOptions.create) but
	 * the operation should fail when a file already exists.
	 */
	exclusive?: boolean;

	/**
	 * Open a file for reading.
	 */
	read?: boolean;

	/**
	 * Open a file for writing.
	 */
	write?: boolean;
}

And it is being used in:

  • readFile
  • writeFile
  • rename
  • copy

create vs exclusive
not clear what the relation between create and exclusive is, can it be both or either one? maybe this should be reflected in some enum so it is clear it can only be one value?

read vs write
what is the use case for this option? should I handle the case in writeFile if options.write is not configured? today in my implementation I totally ignore this.

@bpasero bpasero changed the title FileSystemProvider: FileOptions is a bit weird to support FileSystemProvider: FileOptions is a bit weird to support/understand Apr 25, 2018
@jrieken jrieken added this to the April 2018 milestone Apr 25, 2018
@jrieken jrieken added the remote Remote system operations issues label Apr 25, 2018
@jrieken
Copy link
Member

jrieken commented Apr 25, 2018

Yeah, it's a bit of a kitchen sink...

@jrieken
Copy link
Member

jrieken commented Apr 25, 2018

what is the use case for this option? should I handle the case in writeFile if options.write is not configured? today in my implementation I totally ignore this.

It leaks a little the plan of having fopen/fclose but technically you can combine things, e.g. create a file when trying to read it, like the w+-flag

Similar exclusive is the x flag which causes failure when combined with + and when the file already exists.

@bpasero
Copy link
Member Author

bpasero commented Apr 25, 2018

@jrieken ah ok I was not directly making the connection to the fs file modes, maybe an example in the docs would have helped or different names.

jrieken added a commit that referenced this issue Apr 26, 2018
@jrieken jrieken closed this as completed Apr 26, 2018
@bpasero bpasero added the verified Verification succeeded label Apr 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
remote Remote system operations issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants