summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6f8bfcc)
raw | patch | inline | side by side (parent: 6f8bfcc)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 15 Apr 2016 10:35:47 +0000 (13:35 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 15 Apr 2016 10:38:11 +0000 (13:38 +0300) |
src/sfs/sfs.pas | patch | blob | history |
diff --git a/src/sfs/sfs.pas b/src/sfs/sfs.pas
index 0153c91379793a6ad188f32819c15fffa34fdec0..7588ae7fc7bfad89bb544866293272e1dffe887c 100644 (file)
--- a/src/sfs/sfs.pas
+++ b/src/sfs/sfs.pas
// streaming file system (virtual)
{$MODE DELPHI}
{.$R-}
+{.$DEFINE SFS_VOLDEBUG}
unit sfs;
interface
// ïðèíèìàåòñÿ âî âíèìàíèå òîëüêî ïîñëåäíÿÿ òðóáà.
function SFSAddDataFile (const dataFileName: TSFSString; top: Boolean=false): Boolean;
+// äîáàâèòü ñáîðíèê âðåìåííî
+function SFSAddDataFileTemp (const dataFileName: TSFSString; top: Boolean=false): Boolean;
+
// äîáàâèòü â ïîñòîÿííûé ñïèñîê ñáîðíèê èç ïîòîêà ds.
// åñëè âîçâðàùàåò èñòèíó, òî SFS ñòàíîâèòñÿ âëÿäåëüöåì ïîòîêà ds è ñàìà
// óãðîáèò ñåé ïîòîê ïî íåîáõîäèìîñòè.
if not fOwner.fPermanent and (fOwner.fOpenedFilesCount < 1) then
begin
f := volumes.IndexOf(fOwner);
- if f <> -1 then volumes[f] := nil; // this will destroy the volume
+ if f <> -1 then
+ begin
+ {$IFDEF SFS_VOLDEBUG}writeln('destroying volume "', TVolumeInfo(volumes[f]).fPackName, '"');{$ENDIF}
+ volumes[f] := nil; // this will destroy the volume
+ end;
end;
end;
end;
if fVolume <> nil then Dec(fVolume.fRC);
Dec(TVolumeInfo(volumes[f]).fOpenedFilesCount);
// óáü¸ì çàïèñü, åñëè îíà âðåìåííàÿ, è â íåé íåò áîëüøå íè÷åãî îòêðûòîãî
- if not TVolumeInfo(volumes[f]).fPermanent and
- (TVolumeInfo(volumes[f]).fOpenedFilesCount < 1) then volumes[f] := nil;
+ if not TVolumeInfo(volumes[f]).fPermanent and (TVolumeInfo(volumes[f]).fOpenedFilesCount < 1) then
+ begin
+ {$IFDEF SFS_VOLDEBUG}writeln('destroying volume "', TVolumeInfo(volumes[f]).fPackName, '"');{$ENDIF}
+ volumes[f] := nil;
+ end;
inherited Destroy();
end;
vi.fOpenedFilesCount := 0;
end;
-function SFSAddSubDataFile (const virtualName: TSFSString; ds: TStream;
- top: Boolean = false): Boolean;
+function SFSAddSubDataFile (const virtualName: TSFSString; ds: TStream; top: Boolean=false): Boolean;
var
tv: Integer;
begin
end;
end;
-function SFSAddDataFile (const dataFileName: TSFSString; top: Boolean = false): Boolean;
+function SFSAddDataFile (const dataFileName: TSFSString; top: Boolean=false): Boolean;
var
tv: Integer;
begin
end;
end;
+function SFSAddDataFileTemp (const dataFileName: TSFSString; top: Boolean=false): Boolean;
+var
+ tv: Integer;
+begin
+ try
+ if top then tv := -1 else tv := 1;
+ SFSAddDataFileEx(dataFileName, nil, tv, 0);
+ result := true;
+ except
+ result := false;
+ end;
+end;
+
+
function SFSExpandDirName (const s: TSFSString): TSFSString;
var