text
stringlengths
0
234
(Unsigned_32 (Handle.Start_Cluster) and 16#FFFF_0000#, 16)),
Time => 0,
Date => 0,
Cluster_L => Unsigned_16 (Handle.Start_Cluster and 16#FFFF#),
Size => 0);
Handle.FS.Window (0 .. 31) := To_Data (Dot);
Handle.FS.Window (32 .. 63) := To_Data (Dot_Dot);
Handle.FS.Window (64 .. 95) := (others => 0);
Ret := Handle.FS.Write_Window;
Close (Handle.all);
return Ret;
end Create_Subdir;
----------------------
-- Create_File_Node --
----------------------
function Create_File_Node
(Dir : FAT_Node;
Name : FAT_Name;
New_File : out FAT_Node) return Status_Code
is
Handle : FAT_Directory_Handle_Access;
Ret : Status_Code;
begin
Ret := Dir.FAT_Open (Handle);
if Ret /= OK then
return Ret;
end if;
Ret := Allocate_Entry
(Parent => Handle,
Name => Name,
Attributes => (Read_Only => False,
Hidden => False,
System_File => False,
Volume_Label => False,
Subdirectory => False,
Archive => True),
E => New_File);
Close (Handle.all);
if Ret /= OK then
return Ret;
end if;
return Ret;
end Create_File_Node;
-------------------
-- Delete_Subdir --
-------------------
function Delete_Subdir
(Dir : FAT_Node;
Recursive : Boolean) return Status_Code
is
Parent : FAT_Node;
Handle : FAT_Directory_Handle_Access;
Ent : FAT_Node;
Ret : Status_Code;
begin
Ret := Dir.FAT_Open (Handle);
if Ret /= OK then
return Ret;
end if;
while Read (Handle.all, Ent) = OK loop
if -Long_Name (Ent) = "." then
null;
elsif -Long_Name (Ent) = ".." then
Parent := Ent;
elsif not Recursive then
return Non_Empty_Directory;
else
if Ent.Attributes.Subdirectory then
Ret := Delete_Subdir (Ent, True);
else
Ret := Delete_Entry (Dir, Ent);
end if;
if Ret /= OK then
Close (Handle.all);
return Ret;
end if;
end if;
end loop;
Close (Handle.all);
-- Free the clusters associated to the subdirectory