本文整理汇总了C#中GLib.MakeDirectoryWithParents方法的典型用法代码示例。如果您正苦于以下问题:C# GLib.MakeDirectoryWithParents方法的具体用法?C# GLib.MakeDirectoryWithParents怎么用?C# GLib.MakeDirectoryWithParents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLib
的用法示例。
在下文中一共展示了GLib.MakeDirectoryWithParents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyRecursive
public static bool CopyRecursive(this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback)
{
bool result = true;
GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, cancellable);
if (ft != GLib.FileType.Directory) {
Hyena.Log.DebugFormat ("Copying \"{0}\" to \"{1}\"", source.Path, target.Path);
return source.Copy (target, flags, cancellable, callback);
}
if (!target.Exists) {
Hyena.Log.DebugFormat ("Creating directory: \"{0}\"", target.Path);
result = result && target.MakeDirectoryWithParents (cancellable);
}
GLib.FileEnumerator fe = source.EnumerateChildren ("standard::name", GLib.FileQueryInfoFlags.None, cancellable);
GLib.FileInfo fi = fe.NextFile ();
while (fi != null) {
GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name));
GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name));
result = result && source_file.CopyRecursive(target_file, flags, cancellable, callback);
fi = fe.NextFile ();
}
fe.Close (cancellable);
return result;
}