samuelcampos / usbdrivedetector

A Java library to get a list of all usb storage devices connected to the computer.
MIT License
128 stars 46 forks source link

fixed macos code #11

Closed weirdkid closed 7 years ago

weirdkid commented 7 years ago

The system_profiler commands weren't working -- the SPUSBDataType output doesn't include the Mount Point anymore so I used df and diskutil instead. I tested it on Mac OSX 10.8, 10.11, and 10.12, and I'm comfortable assuming it will work on 10.9 and 10.10 too.

After this commit, I took my fork off in a direction that you may not want to go (like fixing the misspelled package name and removing guava dependency). I also need to get it working in Java 1.6, so I'll probably have to make some bigger changes.

I plan to fix a problem with the Linux detector there too, though. I want it to preserve the volume name -- which isn't always the mount point. I can mount a volume called "MyUSBKey" at mount point "/media/usb", but the current code then thinks the volume name is "usb". I'll try to pull that fix over onto this "backward compatible" branch that I plan to keep in sync with your master.

Thanks,

Matt

samuelcampos commented 7 years ago

Thank you for your contribution

samuelcampos commented 7 years ago

I've follow your suggestions, expect to get it working in Java 1.6. And I've release the version 2.0, since the rename of the main package made it incompatible with the previous code.