如何从JFileChooser检索UNC路径而不是映射驱动器路径 [英] How to retrieve the UNC path instead of mapped drive path from JFileChooser
问题描述
只是想知道是否有办法从使用JFileChooser选择的文件中返回UNC路径。我将选择的文件将驻留在具有UNC路径的映射驱动器上。现在,我似乎只能拉回映射驱动器的驱动器号。
Just wondering if there is a way to return back the UNC path from a file chosen with JFileChooser. The file that I would be selecting would reside on a mapped drive that has a UNC path. Right now, I can only seem to pull back the drive letter of a mapped drive.
推荐答案
JFileChooser
method getSelectedFile()
返回 文件
,其中可能包含有用的信息。
The JFileChooser
method getSelectedFile()
returns a File
, which may have helpful information.
对于Microsoft Windows平台,...前缀为a UNC路径名是\\\\
;主机名和共享名称是名称序列中的前两个名称。
"For Microsoft Windows platforms,…the prefix of a UNC pathname is "\\\\"
; the hostname and the share name are the first two names in the name sequence."
这篇关于如何从JFileChooser检索UNC路径而不是映射驱动器路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!