本文整理汇总了C#中FilePath.GetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# FilePath.GetDirectory方法的具体用法?C# FilePath.GetDirectory怎么用?C# FilePath.GetDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath.GetDirectory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public TopicTree Read(FilePath path)
{
var root = path.GetDirectory();
root = root.Combine("docs");
var file = _fileSystem.GetFile(path);
if (file.Exists)
{
using (var stream = file.OpenRead())
{
return FixLinks(Read(root, stream));
}
}
var message = $"Could not find toc file ({path.FullPath}).";
throw new FileNotFoundException(message);
}
示例2: AndroidPackage
public static FilePath AndroidPackage (this ICakeContext context, FilePath projectFile, bool sign = false, Action<DotNetBuildSettings> configurator = null)
{
var target = sign ? "SignAndroidPackage" : "PackageForAndroid";
if (!context.FileSystem.Exist (projectFile))
throw new CakeException ("Project File Not Found: " + projectFile.FullPath);
context.DotNetBuild (projectFile, c => {
c.Configuration = "Release";
c.Targets.Add (target);
// Pass along configuration to user for further changes
if (configurator != null)
configurator (c);
});
var searchPattern = projectFile.GetDirectory () + (sign ? "/**/*-Signed.apk" : "/**/*.apk");
// Use the globber to find any .apk files within the tree
return context.Globber
.GetFiles (searchPattern)
.OrderBy (f => new FileInfo (f.FullPath).LastWriteTimeUtc)
.FirstOrDefault ();
}