From 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:32:16 +0800 Subject: + Penlight --- .../Penlight/docs/examples/testclone.lua.html | 165 +++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 Data/Libraries/Penlight/docs/examples/testclone.lua.html (limited to 'Data/Libraries/Penlight/docs/examples/testclone.lua.html') diff --git a/Data/Libraries/Penlight/docs/examples/testclone.lua.html b/Data/Libraries/Penlight/docs/examples/testclone.lua.html new file mode 100644 index 0000000..1e48839 --- /dev/null +++ b/Data/Libraries/Penlight/docs/examples/testclone.lua.html @@ -0,0 +1,165 @@ + + + + + Penlight Documentation + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

testclone.lua

+
+--cloning a directory tree.
+local lfs = require 'lfs'
+local path = require 'pl.path'
+local dir = require 'pl.dir'
+
+local p1 = [[examples]]
+local p2 = [[copy/of/examples]]
+
+if not path.isfile 'examples/testclone.lua' then
+	return print 'please run this in the penlight folder (below examples)'
+end
+
+-- make a copy of the examples folder
+dir.clonetree(p1,p2,dir.copyfile)
+
+assert(path.isdir 'copy')
+
+print '---'
+local t = os.time()
+print(lfs.touch('examples/testclone.lua',t,t+10))
+
+-- this should only update this file
+dir.clonetree(p1,p2,
+function(f1,f2)
+  local t1 = path.getmtime(f1)
+  local t2 = path.getmtime(f2)
+  --print(f1,t1,f2,t2)
+  if t1 > t2 then
+	dir.copyfile(f1,f2)
+	print(f1,f2,t1,t2)
+  end
+  return true
+end)
+
+-- and get rid of the whole copy directory, with subdirs
+dir.rmtree 'copy'
+
+assert(not path.exists 'copy')
+ + +
+
+
+generated by LDoc 1.4.6 +
+
+ + -- cgit v1.1-26-g67d0