All pastes #519649 Raw Edit

Untitled

public text v1 · immutable
#519649 ·published 2007-05-29 18:43 UTC
rendered paste body
unit DGLibraries;

interface

uses
  Classes, SysUtils,Dialogs,
  DGFiles,DGUtils;

type
  DGLibrary = class(TObject)
    pressList: TList;
    booksList: TList;
    boxes: TList;
    currentPath: string;
    booksPath: string;
    pressPath: string;
    booksFolders  : TStringList;
    pressFolders  : TStringList;
    books  : TStringList;
    press  : TStringList;
  private
  public
    constructor Create(); overload;
end;

implementation

constructor DGLibrary.Create();
var
  i: Integer;
begin
  pressList:=TList.Create;
  booksList:=TList.Create;

  currentPath:= GetCurrentDir();
  booksPath:=currentPath+'\publications\08';
  pressPath:=currentPath+'\publications\09';
  if(DirectoryExists(booksPath)) then
  begin
    booksFolders:=GetFolders(booksPath);
  end;
  ShowMessage(IntToStr(booksFolders.Length));

  if(DirectoryExists(pressPath)) then
  begin
    pressFolders:=GetFolders(pressPath);
  end;
  ShowMessage(IntToStr(pressFolders.Length));

end;

end.








function GetFolders(Path: string): TStringList;
 var
  SearchResult : TSearchRec;
  Temp: TList;
begin
  Result:=TStringList.Create;
  if FindFirst(Path+'\*.*', faDirectory, SearchResult) = 0 then
  begin
    repeat
     if (SearchResult.Name <> '.') and (SearchResult.Name <> '..') then
     begin
      Result.Add(Path+'\'+SearchResult.Name);
      ShowMessage (Path+'\'+SearchResult.Name);
     end;
    until FindNext(SearchResult) <> 0;
    FindClose(searchResult);
  end;
end;