{"action":"closed","issue":{"url":"https://api.github.com/repos/lihaoyi/Ammonite/issues/346","repository_url":"https://api.github.com/repos/lihaoyi/Ammonite","labels_url":"https://api.github.com/repos/lihaoyi/Ammonite/issues/346/labels{/name}","comments_url":"https://api.github.com/repos/lihaoyi/Ammonite/issues/346/comments","events_url":"https://api.github.com/repos/lihaoyi/Ammonite/issues/346/events","html_url":"https://github.com/lihaoyi/Ammonite/issues/346","id":134224752,"number":346,"title":"Change `Path` into a wrapper around `java.nio.file.Path`?","user":{"login":"lihaoyi","id":934140,"avatar_url":"https://avatars.githubusercontent.com/u/934140?v=3","gravatar_id":"","url":"https://api.github.com/users/lihaoyi","html_url":"https://github.com/lihaoyi","followers_url":"https://api.github.com/users/lihaoyi/followers","following_url":"https://api.github.com/users/lihaoyi/following{/other_user}","gists_url":"https://api.github.com/users/lihaoyi/gists{/gist_id}","starred_url":"https://api.github.com/users/lihaoyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lihaoyi/subscriptions","organizations_url":"https://api.github.com/users/lihaoyi/orgs","repos_url":"https://api.github.com/users/lihaoyi/repos","events_url":"https://api.github.com/users/lihaoyi/events{/privacy}","received_events_url":"https://api.github.com/users/lihaoyi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-17T09:20:27Z","updated_at":"2016-02-18T00:02:32Z","closed_at":"2016-02-18T00:02:32Z","body":"We could preserve the type-level distinction between `Path` and `RelPath`, as well as the nice superficial syntax and API. But there are things in `nio.file.Path` that I want:\r\n\r\n- The concept of a Root http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html#getRoot(), which should help with https://github.com/lihaoyi/Ammonite/issues/120\r\n- Support for virtual filesystems, such as https://github.com/google/jimfs\r\n- The ability to perform cross-filesystem operations! Copying & moving files to/from virtual and real filesystems, or across different roots, which is impossible unless that paths themselves have pointers to the filesystems they live on\r\n- Easier interop with the rest of the java.nio world\r\n\r\nThis would be a non-trivial philosophical change that would change `Path`s from a transparent struct into an opaque type. Or at very least contain a pointer to an opaque type, the `java.nio.file.FileSystem`. \r\n\r\nIn general, the variables holding the `Root` and `Filesystem` have to live on the paths if we want to be able to perform operations that span multiple `Root`s or `Filesystem`s, which we probably do. In the simplest case, Windows users would need to move files between drives. \r\n\r\nThis is impossible if you store the `Root` and `Filesystem` anywhere else, e.g. on the operations (e.g. `D_drive.cp`, `C_drive.rm`) because you won't be able to refer to paths on multiple drives in one operation. \r\n\r\nThis would also make it more awkward to use (abuse?) `Path` and `RelPath` for other non-filesystem usages. That could be considered a good thing. I've done this and it always proves to be confusing. Better to define a separate non-ammonite `Path` and have the types keep you straight"}}