I'm writing a new backend, but I don't know where to add f.root to path.
Take a look at these codes:
And there was a file /design-book.pdf in remote.
$ ls /home/*/source
design-book.pdf
$ ./rclone -vv copy /home/*/source test2:dest
2020/05/24 09:36:47 DEBUG : rclone: Version "v1.51.0-DEV" starting with parameters ["./rclone" "-vv" "copy" "/home/*/source" "test2:dest"]
2020/05/24 09:36:47 DEBUG : Using config file from "/home/*/.config/rclone/rclone.conf"
2020/05/24 09:36:47 DEBUG : dest: NewFs
2020/05/24 09:36:47 DEBUG : Backend, root: dest: Features
2020/05/24 09:36:47 DEBUG : Backend, root: dest: List:
2020/05/24 09:36:48 DEBUG : Backend, root: dest: design-book.pdf
2020/05/24 09:36:48 DEBUG : Backend, root: dest: newObjectWithFullPath: design-book.pdf
2020/05/24 09:36:50 DEBUG : Backend, root: dest: Features
2020/05/24 09:36:50 DEBUG : Backend, root: dest: Waiting for checks to finish
2020/05/24 09:36:50 DEBUG : design-book.pdf: Modification times differ by -16m14.697906281s: 2020-05-23 15:44:35.697906281 +0800 CST, 2020-05-23 15:28:21 +0800 CST
2020/05/24 09:36:50 DEBUG : Backend, root: dest: Waiting for transfers to finish
2020/05/24 09:36:50 DEBUG : Backend, root: dest: Features
2020/05/24 09:36:50 DEBUG : design-book.pdf: Update: design-book.pdf
First rclone list remote files, but it seems that rclone think /design-book.pdf is dest file, but not /dest/design-book.pdf, but if I add f.root to path in List, it maybe wrong in other cases.
I've read some other backend's code, but they only add f.root in Copy and DirMove, I don't know why.
Can you help me, thanks.
Sorry, I haven't seen your first sentence before
I mean, I have to add root to object's path, I have to add root to object's path in List or NewObject, because when running copy, rclone will use object created by NewObject, as dest object, but I can't add it in List or NewObject, or it will worng when running ls.
Thanks.
I'm writing a file system like backend.
I've found the solution: define 2 path in object: relative path and absolute path, only o.Remote() returns relative path, in other cases use absolute path. By the way, because like box, onedrive use ID to locate the object, so they don't have such problem, and I've read local's codes, it just add f.root to path in newObject.
Yes, but I just use this method now.
It can keep code simple (less contact calling), and if the object is running some function, the contacted string still use memory, and maybe in most time of the object's life cycle, it runs functions that require absolute path.