diff src/luan/modules/IoLuan.java @ 1475:c7b86342857f

more IoUtils
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 18 Apr 2020 11:02:18 -0600
parents 6c6ce14db6a8
children 471ef3e6a84e
line wrap: on
line diff
--- a/src/luan/modules/IoLuan.java	Fri Apr 17 21:53:09 2020 -0600
+++ b/src/luan/modules/IoLuan.java	Sat Apr 18 11:02:18 2020 -0600
@@ -488,18 +488,7 @@
 		}
 
 		public void delete() throws IOException {
-			if( file.exists() )
-				delete(file);
-		}
-
-		private static void delete(File file) throws IOException {
-			File[] children = file.listFiles();
-			if( children != null && !isSymbolicLink(file) ) {
-				for( File child : children ) {
-					delete(child);
-				}
-			}
-			IoUtils.delete(file);
+			IoUtils.deleteRecursively(file);
 		}
 
 		public void mkdir() throws LuanException {
@@ -514,12 +503,8 @@
 				throw new LuanException("couldn't set_last_modified on "+file);
 		}
 
-		private static boolean isSymbolicLink(File file) {
-			return Files.isSymbolicLink(file.toPath());
-		}
-
 		public boolean is_symbolic_link() {
-			return isSymbolicLink(file);
+			return IoUtils.isSymbolicLink(file);
 		}
 	}