Hi, the wiki page is slightly outdated. The native move/copy is really possible with MTP backend, however, it is not supported by all devices unfortunately, which is probably your case. The problem is that the display_name is not for all backends the same as file_name and thus the FUSE daemon calls g_file_move instead of g_file_set_display_name in this case. Maybe the MTP backend should fallback internally to LIBMTP_Set_File_Name in this case..
Regards Ondrej PS: It would probably be better to use KIO MTP slave in this case... út 22. 12. 2020 v 17:34 odesílatel oucaijun.happy--- via gvfs-list <gvfs-list@gnome.org> napsal: > > Hi, > I failed to used QFile::rename (in fact it called POSIX API `rename`) to > rename the file/directory of android mobile. > > ```c++ > QString mtpDirPath = > "/run/user/1000/gvfs/mtp:host=HUAWEI_VOG-AL00_MQS0220407000985/内部存储/Test/"; > bool t_rename_mtp() > { > //Returns true if successful; otherwise returns false. > QString src = mtpDirPath + "dir00"; > QString dest = mtpDirPath + "dir01"; > > QFile from(src); > bool ret = from.rename(dest); // FAILED > return ret; > } > ``` > > ENV: > * CPU : `Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz ` > * MOBILE : `华为 P30 Pro(VOG-AL00)` `华为 nova5 Pro(SEA AL10)` > * `libmtp-dev`: `1.1.16-2` > * `gvfs`: `1.38.1-5` > * `qtbase5-dev`: `5.11.3.28-1+eagle` > * `libglib2.0-0`:`2.58.3.4-1+deepin` > * `libglib2.0-bin`:`2.58.3.4-1+deepin` > > > I read https://wiki.gnome.org/Projects/gvfs/backends to know that mtp backend > do not surpport the move job. But seems the code say something different! > > By reading the source code of gvfs 1.38.1-5 and glib2.0-2.58.3.4, I found the > `move`(POSIX `rename`) and g_file_set_display_name (GIO API) are both > realized in gvfs(mtp backend) and gio. > > > > > I am not sure whether I understood the code correctly, also I failed to debug > the gio code for running error. > Could you kindly tell me the truth? Thank you! > > ________________________________ > oucaijun.ha...@163.com > _______________________________________________ > gvfs-list mailing list > gvfs-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gvfs-list _______________________________________________ gvfs-list mailing list gvfs-list@gnome.org https://mail.gnome.org/mailman/listinfo/gvfs-list