ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Miscellaneous
  • The data directory can be specified during the setup
  • Remark
  • Data folders in Android
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the full path of the directory of HFSQL data files specified by the user when installing the application.
Remark: This directory does not necessarily correspond to the real directory of the data files at runtime (which may have been modified with HSubstDir, HChangeDir, etc.).
AndroidAndroid Widget In Android, returns the full path of the default directory containing the databases of the application. This directory cannot be configured.
Example
// Create a .INI file
INIDir is string
IF fDataDir() <> "" THEN
	INIDir = fDataDir() + ["\"] + "MYPROJET.INI"
ELSE
	INIDir = "MYPROJECT.INI"
END
INIWrite("SECTION", "ALREADYRUN", "YES", INIDir)
Syntax
<Result> = fDataDir()
<Result>: Character string
  • Full path (for example: "D:\DATA\Rewali") or UNC path (for example: "\\SERVER\DATA\Rewali") of the directory for the HFSQL data files.
  • Result of fExeDir if no directory was specified during the setup (in test mode and when running an executable without setup).
  • AndroidAndroid Widget Full path of the default directory containing the application database(s) in the internal storage area. This directory corresponds to the "Databases" directory of the application. This directory cannot be configured.
  • iPhone/iPadIOS WidgetMac Catalyst Full path of the directory containing the databases of the application. This directory corresponds to the "Documents" directory of the application. This directory cannot be configured.
Remarks
WINDEVReports and QueriesUser code (UMC)

Miscellaneous

  • If HSubstDir is used in the code of the application, the directory specified by the user during the setup will be ignored.
  • If the data files are described in the analysis with a specific directory (not recommended), this directory will not be taken into account. Only the directory specified by the user during the setup will be taken into account.
  • The fDataDir function is not equivalent to the Directory property.
WEBDEV - Server codeAjax

The data directory can be specified during the setup

  • In the setup is performed via physical media, the directory of the data files is specified during the setup.
  • For a remote setup (FTP), the Internet provider supplies the home directory for the data files and the user supplies the name of the subdirectory in which the data files are installed.
PHP

Remark

fDataDir and fExeDir return the same value.
Android Widget

Data folders in Android

In Android, the folders corresponding to the data are not simply identified.
The following code is used to list the main files and the correspondence of these files when the device is connected to a computer.
// List the main usable folders in Android
sDirectoryInfo is string

// Default data folder 
sDirectoryInfo += [CR] + "fDataDir: " + fDataDir()
// Example: /data/user/0/com.mycompany.projet_name/databases
// Folder NOT accessible by a computer when it is connected

// Main external storage card 
// (or internal storage that emulates an external card)
sDirectoryInfo += [CR] + "SysDirStorageCard: " + SysDirStorageCard()
// Example: /storage/emulated/0
// Folder accessible by a computer when it is connected, 
// it is seen as the "root" of a disk on the device

// All the devices on which it is possible to read or write
FOR n= 1 _TO_ SysNbExternalStorage()
	// Home folder of this device (or emulated device)
	sDirectoryInfo += [CR] + "SysDirExternalStorage(" + n + ", ssePublic): " + ...
		SysDirExternalStorage (n, ssePublic)
	// Example for an emulated card: /storage/emulated/0
	// Folder accessible by a computer when it is connected, 
	// it is seen as the "root" of a disk on the device

	// Data file directory of the current application 
	// (when the data is on the card)
	sDirectoryInfo += [CR] + "SysDirExternalStorage(" + n + ", sseAppFile): " + ...
		SysDirExternalStorage(n, sseAppFile)
	// Example: /storage/emulated/0/Android/data/com.mycomany.project_name/files
	// Folder accessible by a computer when it is connected, 
	// it is seen as the subdirectory 
	// "\Android\data\com.mycompany.project_name\files" of a disk

	// Document folder of the current application 
	sDirectoryInfo += [CR] + "SysDirExternalStorage(" + n + ", sseAppDocument): " + ...
			SysDirExternalStorage(n, sseAppDocument)
	// Example: /storage/emulated/0/Android/data/com.mycomany.project_name/files/Documents
	// Folder accessible by a computer when it is connected, 
	// it is seen as the subdirectory 
	// "\Android\data\com.mycompany.project_name\Documents" of a disk

	// Folder with "public" / "shared" documents, common to all the applications 
	sDirectoryInfo += [CR] + "SysDirExternalStorage(" + n + ", ssePublicDocument): " + ...
			SysDirExternalStorage(n, ssePublicDocument)
	// Example: /storage/emulated/0/Documents
	// Folder accessible by a computer when it is connected, 
	// it is seen as the "\Documents" subdirectory of a disk

END

// Directory with the cache files of the application 
// (this data can be deleted by the user or the system)
sDirectoryInfo += [CR] + "fCacheDir: " + fCacheDir()
// Example: /data/user/0/com.mycompany.project_name/cache
// Folder NOT accessible by a computer when it is connected

// To have information in the Android Device Monitor traces 
// (.\personal\Android\AndroidSDK\tools\monitor.bat)
Trace(sDirectoryInfo)
Info(sDirectoryInfo)
Component: wd300vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/07/2024

Send a report | Local help