Diff

Differences From Artifact [a394650d8e]:

To Artifact [e7e131fd9c]:


675
676
677
678
679
680
681


682
683
684
685
686
687
688
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690







+
+







		array set retval [list]

		catch {
			::appfs::getindex $pathinfo(hostname)
			::appfs::getpkgmanifest $pathinfo(hostname) $pathinfo(package_sha1)
		}

		set retval(path_type) $pathinfo(_type)

		switch -- $pathinfo(_type) {
			"toplevel" {
				set retval(type) directory
				set retval(childcount) [llength [getchildren $path]]
			}
			"sites" {
				set check [::appfs::db onecolumn {SELECT 1 FROM packages WHERE hostname = $pathinfo(hostname);}]
752
753
754
755
756
757
758

759
760
761
762
763
764
765
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768







+







							file lstat $localpath localpathinfo
						}
					}
				}

				if {$localpath != "" && [info exists localpathinfo]} {
					set retval(is_localfile) 1
					unset retval(packaged)
					catch {
						set retval(time) $localpathinfo(mtime)

						switch -- $localpathinfo(type) {
							"directory" {
								set retval(type) "directory"
								set retval(childcount) [llength [getchildren $path]]
837
838
839
840
841
842
843
844

845
846
847
848
849
850
851
840
841
842
843
844
845
846

847
848
849
850
851
852
853
854







-
+







		return [array get retval]
	}

	proc openpath {path mode} {
		array set pathinfo [_parsepath $path]

		if {$pathinfo(_type) != "files"} {
			return -code error "invalid type"
			return -code error "invalid path type: Got \"$pathinfo(_type)\", need \"files\""
		}

		set localpath [_localpath $pathinfo(package) $pathinfo(hostname) $pathinfo(file)]

		if {$mode == "create"} {
			if {$localpath == ""} {
				return -code error "Asked to create, but no home directory."
901
902
903
904
905
906
907
908

909
910
911
912
913
914
915
904
905
906
907
908
909
910

911
912
913
914
915
916
917
918







-
+







		return $localcachefile
	}

	proc localpath {path} {
		array set pathinfo [_parsepath $path]

		if {$pathinfo(_type) != "files"} {
			return -code error "invalid type"
			return -code error "invalid path type: Got \"$pathinfo(_type)\", need \"files\""
		}

		set localpath [_localpath $pathinfo(package) $pathinfo(hostname) $pathinfo(file)]

		return $localpath
	}

950
951
952
953
954
955
956
957
958


959
960
961
962
963
964
965
953
954
955
956
957
958
959


960
961
962
963
964
965
966
967
968







-
-
+
+








		return $filename
	}

	proc unlinkpath {path} {
		array set pathattrs [exists $path]

		if {![info exists pathattrs(packaged)]} {
			return -code error "invalid type"
		if {$pathattrs(path_type) != "files"} {
			return -code error "invalid path type: can only delete type \"files\" this is type \"$pathattrs(path_type)\""
		}

		set localpath $pathattrs(localpath)

		if {$localpath == ""} {
			return -code error "Asked to delete, but no home directory."
		}