copyFileTo creates subdirectory in target directory with target's name
See original GitHub issueHi, first let me thank you for this great library.
Library version: 1.5.1 OS version: [Android 12] Device model: Realme 7
In my app the user can choose a file (mStorageHelper.openFilePicker()), after this the selected file is copied to the apps internal storage and user can edit it in the app. After editing the user can finish editing and copy back the file to the original place. When I copy the file back from the apps storage to the original folder, the copyFile methode creates a subfolder in the target
File sourceDBFile = new File(data.m_filename);
// app internal filename data.m_filename = "/data/user/0/xxx.xxx.xxx/files/projects/yyy.db"
DocumentFile source = DocumentFile.fromFile(sourceDBFile);
DocumentFileUtils.copyFileTo(source, ctx, data.m_localImportSourcePath, null, new FileCallback() ...
// with data.m_localImportSourcePath = "/storage/emulated/0/test", this is the original folder
Result is the copied file yyy.db is in the folder /storage/emulated/0/test/test with absolute path
/storage/emulated/0/test/test/yyy.db
If I try to copy to the targets parent I get the error “CANNOT_CREATE_FILE_IN_TARGET”, of course I only have the permission for the “test” folder How can I prevent this? Is this the intented behaviour? Thx and best reagrds Klaus
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
NuGet package targets - how to copy files to subfolder of ...
I am able to create a targets file that copies 1.txt to the root, ... you get it to create the SubFolder and...
Read more >Copy and Create Destination Directory if it Does Not Exist
In this tutorial, we'll discuss how to create the non-existing target directory automatically when we copy files.
Read more >CopyFiles@2 - Copy files v2 task
Copy files v2 # Copy files from a source folder to a target folder using patterns matching file paths (not folder paths).
Read more >Makefile for Projects with Subdirectories - Dash's Blog
The directory part of the file name of the target, with the trailing slash removed. If the value of $@ is dir/foo.o then...
Read more >How to CMake Good - 1c - Subdirectories and Target Interface ...
You probably don't want a single flat project structure, especially if you have many files and targets. You'll also want to tag "usage ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a temporary solution, please go ahead with
copyFileTo(Context, DocumentFile, FileDescription, FileCallback)
:Fixed in v1.5.2