有没有一种方法可以轻松地解析便携式类库文件路径?路径、类库、轻松、文件

2023-09-04 00:52:27 作者:治愈系少男

我需要解析的路径分成部分从一个便携式类库和得到的东西,如文件名,扩展名,只是目录名等。

I'm needing to parse a path into parts from within a portable class library and get things like the filename, extension, just directory name, etc.

所有这些方法是相当容易从内System.IO.Path访问,但是,这似乎并没有内便携式类库存在。是否有一个开放源码的替代本或其他的API,它会给我相同的功能?

All of these methods are fairly easy to access from within System.IO.Path, however, this doesn't seem to exist within portable class libraries. Is there an open source replacement for this or some other API that would give me the same functionality?

推荐答案

您可能能够使用或调整$ C $下System.IO.Path从单声道:的 https://github.com/mono/mono/blob/master/mcs/class/ corlib / System.IO / Path.cs

You may be able to use or adapt the code for System.IO.Path from Mono: https://github.com/mono/mono/blob/master/mcs/class/corlib/System.IO/Path.cs

编辑:另外,我的 PCL存储库提供了一些文件IO API来PCLS,包括 PortablePath.Combine()

Also, my PCL Storage library provides some file IO APIs to PCLs, including PortablePath.Combine().