! Copyright (C) 2023 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: cli.git formatting http.client io.directories io.files
-io.files.temp io.launcher io.pathnames kernel layouts namespaces
-sequences splitting system ;
+USING: cli.git combinators.short-circuit formatting http.client
+io.directories io.files io.files.info io.files.temp io.launcher
+io.pathnames kernel layouts namespaces sequences splitting
+system ;
IN: build-from-source
: dll-out-directory ( -- path )
: with-build-directory ( quot -- ) [ "build" ] dip with-build-directory-as ; inline
+: empty-directory? ( path -- ? )
+ { [ directory? ] [ directory-files empty? ] } 1&& ;
+
+! Windows clears the Factor temp directory but leaves the directory names (?)
+! C:\Users\sheeple\AppData\Local\Temp\factorcode.org\Factor>
+: ?sync-repository-as ( url path -- )
+ dup { [ git-directory? ] [ ".git" append-path empty-directory? not ] } 1&&
+ [ dup delete-tree ] unless
+ sync-repository-as wait-for-success ;
+
: with-updated-git-repo-as ( git-uri path quot -- )
'[
- _ _ [
- sync-repository-as wait-for-success
- ] keep
+ _ _ [ ?sync-repository-as ] keep
prepend-current-path _ with-directory
] with-temp-directory ; inline