Improved the usability and flexability of the mountpath parameter.

This commit is contained in:
Maschell 2019-04-11 23:13:27 +02:00
parent f0e23f608f
commit 0af70ed3a4
2 changed files with 30 additions and 25 deletions

View File

@ -56,20 +56,23 @@ The most imported argument in the `-in` argument which defines the input path. I
## Mount path
The mountpath will be set via the `-mountpath` argument and will set the target of fuse-wiiu. The expected value if different between differnt OS.
The mountpath will be set via the `-mountpath` argument and will set the target of fuse-wiiu. This can be almost any path (and a drive on Windows).
Just make sure:
- The path doesn't exist - but the parent path (if existing) DOES exist.
- (unix) The user can only mount on a mountpoint for which he has write permission
- (unitx) The mountpoint must not be a sticky directory which isn't owned by the user (like /tmp usually is)
### Windows
On Windows, the files will be mounted to a completly new drive, so you have to pass a drive letter as a mountpass.
Example:
**Example Windows:**
To mount the folder `H:/WiiU` to `Q:/` you would use something like this:
`java "-Dfile.encoding=UTF-8" -jar wiiu-fuse.jar -in H:/WiiU -mountpath Q`
**Note: You may need to force Java to use the UTF-8 charset. Quoting the VM argument is need by Powershell and may could be removed**
### Unix
On Unix, the mounted files are available inside a folder of the `/tmp/` directory. The exact path will be `/tmp/mnt_wiiu_[mountpath]` where `[mountpath]` will be replaced by the value of `-mountpath`.
Example:
To mount the home folder to `/tmp/mnt_wiiu_test` you use something like this:
`java -jar wiiu-fuse.jar -in ~ -mountpath test`
To mount the folder `H:/WiiU` to `C:/mounted` you would use something like this:
`java "-Dfile.encoding=UTF-8" -jar wiiu-fuse.jar -in H:/WiiU -mountpath C:/mounted`
**Note: You may need to force Java to use the UTF-8 charset. Quoting the VM argument is need by Powershell**
**Example Unix:**
To mount the home folder to `~/test` you use something like this:
`java -jar wiiu-fuse.jar -in ~ -mountpath ~/test`
## Optional arguments.

View File

@ -92,14 +92,14 @@ public class Main {
CommandLineParser parser = new DefaultParser();
CommandLine cmd = null;
String driveLetter = "Y";
String mountPath = "";
cmd = parser.parse(options, args);
String inputPath = "";
if (cmd.hasOption(OPTION_MOUNTPATH)) {
driveLetter = cmd.getOptionValue(OPTION_MOUNTPATH);
mountPath = cmd.getOptionValue(OPTION_MOUNTPATH);
}
if (cmd.hasOption(OPTION_INPUT)) {
@ -132,6 +132,16 @@ public class Main {
Settings.titlekeyPath = new File(cmd.getOptionValue(OPTION_TITLEKEYS));
}
File mount = new File(mountPath);
File mountparent = mount.getParentFile();
if (mountparent != null && !mountparent.exists()) {
System.err.println("Mounting to " + mount + " is not possible." + mountparent + " does not exist");
return;
} else if (mount.exists()) {
System.err.println("Mounting to " + mount + " is not possible. It's already mounted or in use");
return;
}
if (!Arrays.equals(HashUtil.hashSHA1(Settings.retailCommonKey), Settings.retailCommonKeyHash)) {
System.err.println("WARNING: Retail common key is not as expected");
} else {
@ -160,18 +170,9 @@ public class Main {
}
RootFuseFS stub = new RootFuseFS(root);
try {
String path;
switch (Platform.getNativePlatform().getOS()) {
case WINDOWS:
path = driveLetter + ":\\";
break;
default:
path = "/tmp/mnt_wiiu_" + driveLetter;
new File(path).mkdirs();
}
System.out.println("Mounting " + new File(inputPath).getAbsolutePath() + " to " + path);
stub.mount(Paths.get(path), true, true);
try {
System.out.println("Mounting " + new File(inputPath).getAbsolutePath() + " to " + mount.getAbsolutePath());
stub.mount(mount.toPath(), true, true);
} finally {
stub.umount();
}
@ -179,7 +180,8 @@ public class Main {
private static Options getOptions() {
Options options = new Options();
options.addOption(Option.builder(OPTION_MOUNTPATH).required().hasArg().desc("On Windows: the target drive letter. Unix: will be mounted to \"/tmp/mnt_wiiu_[MOUNTPATH]\"").build());
options.addOption(Option.builder(OPTION_MOUNTPATH).required().hasArg()
.desc("The target mount path.").build());
options.addOption(Option.builder(OPTION_INPUT).required().hasArg().desc("input path").build());
options.addOption(Option.builder(OPTION_DISCKEYS).optionalArg(true).hasArg()
.desc("Path of .key files used to decrypt WUD/WUX. If not set \"" + HOMEPATH + File.separator + DISC_KEY_PATH + "\" will be used.").build());