filestorage ToplevelDir property
Return to Introduction  Previous page  Next page
Applies to
acFileStorage component as subproperty of AutoExtract.ExtractTo structure.  

Declaration
type  
TacSystemDirectory = (sdCurrentDir,  
                      sdDesktop, sdMyDocuments, sdMyPictures,  
                      sdAppData, sdProgramFiles, sdWindowsDir,  
                      sdSystemDir, sdTempDir, sdHelpDir,  
                      sdMediaDir, sdCursorsDir, sdNone);  
 
property ToplevelDir: TacSystemDirectory;  

Description
The ToplevelDir property specifies the directory where you would like to automatically extract files on program startup.  

Examples of usage
1. If you would like to extract stored files to the Desktop — just make TopLevelDir property "sdDesktop". Leave SubDirectory string clean.  
 
2. If you would like to extract files to current directory, create subdirectory named, let's say, "plugins" and extract files there — set ToplevelDir property as "sdCurrentDir" and assign SubDirectory property as "plugins" (SubDirectory := 'plugins'). If you would like to create this subdirectory automatically even if it's does not exists — set CreatePath property to True.  
 
3. If you would like to extract your files to non-system folder (for example, to "h:\databases\my own database\") then you don't need to use any top level directories, just set ToplevelDir property to "sdNone" and assign to SubDirectory "h:\databases\my own database" path. If you would like to create this subdirectory automatically even if it's does not exists — set CreatePath property to True.  

Notes
1. You don't need to change anything from AutoExtract subproperties at run-time because of these auto extracting features used by acFileStorage on program startup only. You may set this property at design-time only, all run-time modifications will senseless.  
 
2. Current directory (sdCurrentDir) is the same as ExtractFilePath(Application.ExeName).  
 
3. If TopLevelDir = sdNone, the file will be extracted to absolute path specified in SubDirectory property.  

See also
GetSysDir and ExpandToRealPath functions.