AmazeFileManager icon indicating copy to clipboard operation
AmazeFileManager copied to clipboard

Unable rename "folder" to ".folder"

Open armitageone opened this issue 10 years ago • 2 comments

I try to rename folder "folder" to ".folder" and got fail message, but it renamed to "upfolder.folder" where "upfolder" is upper level folder.

Was: \sdcard1\folder Want: \sdcard1\.folder Got: \sdcard1\sdcard1.folder

armitageone avatar Nov 29 '16 07:11 armitageone

hello,

in 3.1.2 beta 5, it seems rename process is not working... I made this modification in Main.java lines 1115 to 1122 on my local code :

From

if (!MainActivityHelper.isNewDirectoryRecursive(new HFile(openMode, CURRENT_PATH + "/" + name)) &&
                        Operations.isFileNameValid(name)) {
                    if (openMode == OpenMode.FILE)
                        MAIN_ACTIVITY.mainActivityHelper.rename(openMode, f.getPath(), CURRENT_PATH + "/" + name, getActivity(), BaseActivity.rootMode);
                    else
                        MAIN_ACTIVITY.mainActivityHelper.rename(openMode, (f).getPath(), (CURRENT_PATH + "/" + name), getActivity(), BaseActivity.rootMode);

                }

To

                if (!MainActivityHelper.isNewDirectoryRecursive(new HFile(openMode, CURRENT_PATH + "/" + name)) &&
                        Operations.isFileNameValid(name)) {
                        MAIN_ACTIVITY.mainActivityHelper.rename(openMode, (f).getPath(), (CURRENT_PATH + "/" + name), getActivity(), BaseActivity.rootMode);

                }

From my understanding, problem was linked to the slash missing between CURRENT_PATH & 'name'. New code will include slash in all cases. I didn't find any bug on rename process with this modification.

Maybe in the past there was a reason to treat the files of type OpenMode.FILE in a different way than the other ? I don't know...

altintorr avatar Dec 03 '16 09:12 altintorr

Fixed!

VishalNehra avatar Dec 04 '16 10:12 VishalNehra