Example #1
0
        /// <summary>
        /// Delete the directory with the given path.
        /// </summary>
        public static void Delete(string path, bool recursive)
        {
            var file = new JFile(path);

            if (file.IsDirectory())
            {
                if (recursive)
                {
                    var children = file.List();
                    foreach (var child in children)
                    {
                        var childFile = new JFile(child);
                        if (childFile.IsFile())
                        {
                            childFile.Delete();
                        }
                        if (childFile.IsDirectory())
                        {
                            Delete(child, recursive);
                        }
                    }
                }
                file.Delete();
            }
        }
Example #2
0
        /// <summary>
        /// Delete the directory with the given path.
        /// </summary>
        public static void Delete(string path)
        {
            var file = new JFile(path);

            if (file.IsDirectory())
            {
                file.Delete();
            }
        }
Example #3
0
 /// <summary>
 /// Delete the directory with the given path.
 /// </summary>
 public static void Delete(string path, bool recursive)
 {
     var file = new JFile(path);
     if (file.IsDirectory())
     {
         if (recursive)
         {
             var children = file.List();
             foreach (var child in children)
             {
                 var childFile = new JFile(child);
                 if (childFile.IsFile()) childFile.Delete();
                 if (childFile.IsDirectory()) Delete(child, recursive);
             }
         }
         file.Delete();
     }
 }
Example #4
0
 private Java.Io.File[] GetEntries(string path)
 {
     var dir = new Java.Io.File(path);
     if (dir.Exists() && dir.IsDirectory())
     {
         var entries = dir.ListFiles();
         if (entries != null)
         {
             var list = entries.OrderBy(x => x.Name).ToList();
             if (path != startPath)
             {
                 var parent = dir.ParentFile;
                 if (parent != null)
                 {
                     list.Insert(0, parent);
                 }
             }
             return list.ToArray();
         }
     }
     return new Java.Io.File[0];
 }
Example #5
0
        private Java.Io.File[] GetEntries(string path)
        {
            var dir = new Java.Io.File(path);

            if (dir.Exists() && dir.IsDirectory())
            {
                var entries = dir.ListFiles();
                if (entries != null)
                {
                    var list = entries.OrderBy(x => x.Name).ToList();
                    if (path != startPath)
                    {
                        var parent = dir.ParentFile;
                        if (parent != null)
                        {
                            list.Insert(0, parent);
                        }
                    }
                    return(list.ToArray());
                }
            }
            return(new Java.Io.File[0]);
        }
Example #6
0
        /// <summary>
        /// Does a directory with given path exist on the filesystem?
        /// </summary>
        public static bool Exists(string path)
        {
            var file = new JFile(path);

            return(file.IsDirectory() && file.Exists());
        }
Example #7
0
 /// <summary>
 /// Does a directory with given path exist on the filesystem?
 /// </summary>
 public static bool Exists(string path)
 {
     var file = new JFile(path);
     return file.IsDirectory() && file.Exists();
 }
Example #8
0
 /// <summary>
 /// Delete the directory with the given path.
 /// </summary>
 public static void Delete(string path)
 {
     var file = new JFile(path);
     if (file.IsDirectory())
         file.Delete();
 }