Notice: Comments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #599 (new Task)

Opened 5 years ago

Last modified 16 months ago

Identify a device by label, not drive letter (windows)

Reported by: bflorat Owned by: bflorat
Priority: 5, normal Milestone: To Be Decided by Jajuk Team
Component: Core Version: 1.3.10
Keywords: collection Cc:

Description

Under windows, identify a drive by partition label, not only the drive letter to allow using the same PATH (M:\music) for instance for different drives.

Get label: Runtime runtime = Runtime.getRuntime(); Process p = runtime.exec("cmd.exe /c dir d:"); BufferedReader? br = new BufferedReader?(new InputStreamReader?(p.getInputStream())); String volume = br.readLine(); Matcher matcher = Pattern.compile("(\\s)*Volume in drive \\w is (\\w|\\p{Punct})*").matcher(volume); if (matcher.find()) {

volume = volume.substring(matcher.start(), matcher.end()); volume = volume.replaceAll("(\\s)*Volume in drive \\w is ","");

} else if (Pattern.compile("Volume in drive \\w has no label").matcher(volume).find()) {

volume = null;

}

Attachments

Change History

Changed 5 years ago by bflorat

  • summary changed from Identify a device by drive letter to Identify a device by label, not drive letter (windows)

Changed 5 years ago by bflorat

  • milestone set to To Be Decided by Jajuk Team

Changed 17 months ago by bflorat

  • priority changed from 2, lowest to 5, normal
  • type changed from Feature to Task

Sounds interesting, should be studied

Changed 16 months ago by bflorat

  • keywords collection added

Add/Change #599 (Identify a device by label, not drive letter (windows))

Author



Action
as new
 
Note: See TracTickets for help on using tickets.