You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I'm facing some problems using the Prompt.file utility.
The first surprising thing is that using a filter to check the file extension can also remove the ability to travel to upper directories, so instead of just checking for the extension I also have to account for .., not very annoying, but worth mentioning IMO.
Second is that the provided path is not absolute, neither relative to the starting directory where the execution started, so if you want to check if the file is a directory (for example) and the user has navigated to a subfolder or to a parent folder, you have no way to know where is the actual file your filer has to check.
Here is an example of what I'm trying:
constxmlPath=yield*Prompt.file({filter: (p)=>Effect.gen(function*(_){console.log(p);conststat=yield*fs.stat(path.resolve(p)).pipe(Effect.orDie);returnstat.type==="Directory"||p.endsWith(".xml");}),message: "Please select one XML file",});
What is the feature you are proposing to solve the problem?
The filter should receive a full path, or a relative path, or a file handle
What alternatives have you considered?
The only one I can think about is to implement my own custom input
The text was updated successfully, but these errors were encountered:
What is the problem this feature would solve?
Hello. I'm facing some problems using the Prompt.file utility.
The first surprising thing is that using a filter to check the file extension can also remove the ability to travel to upper directories, so instead of just checking for the extension I also have to account for
..
, not very annoying, but worth mentioning IMO.Second is that the provided path is not absolute, neither relative to the starting directory where the execution started, so if you want to check if the file is a directory (for example) and the user has navigated to a subfolder or to a parent folder, you have no way to know where is the actual file your filer has to check.
Here is an example of what I'm trying:
What is the feature you are proposing to solve the problem?
The filter should receive a full path, or a relative path, or a file handle
What alternatives have you considered?
The only one I can think about is to implement my own custom input
The text was updated successfully, but these errors were encountered: