Closed SNUyi closed 7 months ago
I tried to change the AccessMask to GENERIC_ALL but still it doesn't work.
Line 281 of SMBjClient.kt
diskEntry.rename(targetConnection.name)
<- renames the file with the same connection's name or folder's name in my case.
should be
diskEntry.rename(targetConnection.sharePath)
<- correctly renames the file
But in both cases, we will get error bubble in the Files
app stating the rename failed (although the second one succeeded). But this is only for renaming files. It doesn't even work for renaming directories. If it was a directory, an exception will be thrown complaining it was a directory and not a file.
@RebelliousX for example, open directory: diskShare.openDirectory(oldPath, EnumSet.of(AccessMask.GENERIC_ALL), null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null)
open file: diskShare.openFile( sharePath, EnumSet.of(AccessMask.GENERIC_ALL), EnumSet.of(FileAttributes.FILE_ATTRIBUTE_NORMAL), SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OPEN, null ) it works to me. And diskFile.rename() paramer like this "1_6\image9_6.pdf" "1_6" is parent directory.
@SNUyi I found the cause of this problem. Fix in next version.
https://github.com/wa2c/cifs-documents-provider/commit/4f2280c0e9667d476e6ee5fa48a7346a15d68519
@wa2c Well done
@SNUyi Ver.2.0.0 released. Please check it.
@wa2c OK,thanks!
I think this com.wa2c.android.cifsdocumentsprovider.data.storage.smbj.SmbjClient#renameFile paramer is wrong. And openFile should use AccessMask.GENERIC_ALL, could rename file.