javajimfs

JimFS: what is the purpose of /work directory


I started to use google jimfs and doing ls I found there work directory in the root of FS. What is the purpose of this folder?


Solution

  • It's just an arbitrary directory so that the working directory (the directory that relative paths are resolved against) isn't the root directory, since it typically isn't in real situations. You can change the working directory to whatever you want (including the root) by customizing the Configuration. Here's an example of setting the working directory to the root (in which case the /work directory won't be created):

    Configuration config = Configuration.unix().toBuilder()
        .setWorkingDirectory("/")
        .build();