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

termux-storage-get should have the options to run synchronously and retain original filename. #199

Open
cvirostek opened this issue Jul 26, 2018 · 3 comments

Comments

@cvirostek
Copy link
Contributor

This command would be much easier to use in many cases if it had the option to block execution until a file has been selected and loaded. That way, if a script needs to perform on the file, it will know exactly when it's able to do so.

It would also be helpful to be able to retain the file's name. It could work like cp, mv, etc: if you provide the path to a directory, it will place the file in that directory with its original name. If you provide the path to a file, it would create or overwrite that file.

I have a rough version of this working. If anyone's interested I can clean up the code and publish it.

@setaur
Copy link

setaur commented Sep 2, 2018

Even better IMHO would be if that command only returned a path to selected file (or directory) and user in his bash script could do the rest - moving, copying, creating, removing etc.

@cvirostek
Copy link
Contributor Author

@setaur Good idea, but from my understanding that's only possible for files in external storage. In other cases (e.g. app-specific internal data or Google Drive files) you don't actually have direct read/write access to the file, but the system provides an inputstream to let you read it indirectly.

So to keep the command flexible, perhaps it could have the option to return the file path if it's accessible or copy it to the specified location otherwise.

@chrysn
Copy link

chrysn commented Sep 10, 2018

What termux-storage-get might do to address @setaur's request is to have several modes of output determination:

  • Fixed output location -- as it is
  • Output to a directory with its original file name (suffixed if that file exists, or explicitly overwriting), and print the new file name on stdout -- what @cvirostek is suggesting
  • Output to a (possibly temporary) directory with its original file name, or just the original file name if that file has a physical representation on disk and that is accessible to the caller (both of which might be quite tricky to determine) -- as suggested by @setaur.

At any rate, the last item is in my impression only feasible to address once the second is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants