Gemini explained me this. File.DirData should return ~/.config/ or ~/.local/share/ instead of File.DirApp on Linux machines.
File.DirTemp should return ~/.cache/ I think.
The primary Linux counterpart to Windows AppData/Roaming is
~/.config (XDG_CONFIG_HOME) for configuration files and
~/.local/share (XDG_DATA_HOME) for application data files.
Both are located within the user's home directory ($HOME), making them always readable and writable by that user.
Here is the breakdown of the Linux equivalents for application data.
1. The Standard Counterparts (XDG Specification)
Modern Linux applications follow the XDG Base Directory Specification, which splits the functionality of Windows AppData into specialized folders to reduce clutter in the home directory:
If you are developing or running apps on Linux, ~/.config/ is the recommended location for persistent user settings.
Using this last uncommented command with my WebGL library on a Linux Debian 13 virtual machine works well inside /.config/ folder, because it is in home, is perfectly readable and writable.
I'm interested to know.... what you think about this ?
Here a small test:
File.DirTemp should return ~/.cache/ I think.
The primary Linux counterpart to Windows AppData/Roaming is
~/.config (XDG_CONFIG_HOME) for configuration files and
~/.local/share (XDG_DATA_HOME) for application data files.
Both are located within the user's home directory ($HOME), making them always readable and writable by that user.
Here is the breakdown of the Linux equivalents for application data.
1. The Standard Counterparts (XDG Specification)
Modern Linux applications follow the XDG Base Directory Specification, which splits the functionality of Windows AppData into specialized folders to reduce clutter in the home directory:
- ~/.config/ (default for $XDG_CONFIG_HOME): Equivalent to AppData\Roaming for user-specific settings, configuration files, and keybindings.
- ~/.local/share/ (default for $XDG_DATA_HOME): Equivalent to AppData\Local or Roaming for application-specific data files that should persist but are not user-modifiable settings (e.g., game saves, application databases).
- ~/.cache/ (default for $XDG_CACHE_HOME): For temporary data that can be deleted without losing important application state
- ~/.appname: Many older or simpler applications place a single hidden directory directly in the user's home directory (e.g., ~/.mozilla, ~/.ssh).
| Windows Folder | Linux Counterpart | Purpose |
|---|---|---|
| %APPDATA% | ~/.config/ | User settings, config files. |
| %LOCALAPPDATA% | ~/.local/share/ | App data, database files, saves. |
| (Various) | ~/.cache/ | Cache, temporary data. |
If you are developing or running apps on Linux, ~/.config/ is the recommended location for persistent user settings.
B4X:
' Set here the path where THREEJS distribution was unzipped.
' More concurrent projects can run at same time, just use different port for each if you need this.
' gl.Initialize(Me, "WebGL", "WebGL_Demo1", "GMT+1", File.DirData("B4XWebGL"), Port) ' WINDOWS SPECIFIC
' gl.Initialize(Me, "WebGL", "WebGL__Demo1", "GMT+1", "/home/massimo/.config/B4XWebGL/", Port) ' LINUX SPECIFIC
gl.Initialize(Me, "WebGL", "WebGL__Demo1", "GMT+1", File.Combine(GetSystemProperty("user.home", ""), ".config/B4XWebGL/"), Port) ' LINUX SPECIFIC
Using this last uncommented command with my WebGL library on a Linux Debian 13 virtual machine works well inside /.config/ folder, because it is in home, is perfectly readable and writable.
I'm interested to know.... what you think about this ?
Here a small test:
massimo@debian:~/Desktop$ java --module-path $PATH_TO_FX --add-modules javafx.controls,javafx.graphics,javafx.web,javafx.fxml -jar jWebGL_Demo1.jar
[18/04/2026-13:53:56:174] [STEP 1] Initialize WebGL Library
[18/04/2026-13:53:56:190] Library package: b4j.example.webgl
[18/04/2026-13:53:56:191] [STEP 2] Get 3D Engine
[18/04/2026-13:53:56:210] FOUND THREEJS DISTRIBUTION ON /home/massimo/.config/B4XWebGL
[18/04/2026-13:53:57:463] Found 5930 file/s in 361 folder/s - Total of 6291 folders and files.
[18/04/2026-13:53:57:464] Threejs distribution folder: /home/massimo/.config/B4XWebGL
[18/04/2026-13:53:57:465] Threejs [build] folder: /home/massimo/.config/B4XWebGL/build
[18/04/2026-13:53:57:466] Threejs [project] folder: /home/massimo/.config/B4XWebGL/examples
[18/04/2026-13:53:57:466] Threejs [library] folder: /home/massimo/.config/B4XWebGL/examples/jsm
[18/04/2026-13:53:57:467] [STEP 3] Start 3D engine. You can code your scene on _ReadyToCode sub, then call Update command.
[18/04/2026-13:53:57:468] Start HTTP server on port 8888 serving /home/massimo/.config/B4XWebGL
2026-04-18 13:53:58.351:INFOejs.Server:JavaFX Application Thread: jetty-11.0.9; built: 2022-03-30T17:44:47.085Z; git: 243a48a658a183130a8c8de353178d154ca04f04; jvm 21.0.10+7-Debian-1deb13u1
2026-04-18 13:53:58.975:INFOejss.DefaultSessionIdManager:JavaFX Application Thread: Session workerName=node0
2026-04-18 13:53:59.074:INFOejsh.ContextHandler:JavaFX Application Thread: Started o.e.j.s.ServletContextHandler@63e05ab0{/,file:///home/massimo/.config/B4XWebGL/,AVAILABLE}
2026-04-18 13:53:59.093:INFOejs.RequestLogWriter:JavaFX Application Thread: Opened /home/massimo/Desktop/logs/b4j-2026_04_18.request.log
2026-04-18 13:53:59.168:INFOejs.AbstractConnector:JavaFX Application Thread: Started ServerConnector@42c03b64{HTTP/1.1, (http/1.1)}{0.0.0.0:8888}
2026-04-18 13:53:59.300:INFOejs.Server:JavaFX Application Thread: Started Server@3a771674{STARTING}[11.0.9,sto=0] @15443ms
[18/04/2026-13:53:59:312] Custom server request log is active. Sub WebGL_ServerLog (if exists) will be fired with request logs
[18/04/2026-13:53:59:312] You should use gl.ServerLog(False) to disable it if not required
[18/04/2026-13:53:59:322] HTTP server successfully started
WebGL ReadyToCode. Your WebGL code start here. URL: http://10.0.2.15:8888/examples/WebGL_Demo1.html
File already exist. Avoid to copy it from Assets: /home/massimo/.config/B4XWebGL/examples/textures/crate.gif
Selected demo: DrawCube1
[18/04/2026-13:53:59:410] [STEP 4] Update 3D engine
[18/04/2026-13:53:59:414] Save HTML file: /home/massimo/.config/B4XWebGL/examples/WebGL_Demo1.html
Server static folder: /home/massimo/.config/B4XWebGL
To access the scene:
To access the library main page:
10.0.2.15 - [18/04/2026 13:17:17:204 +0100] [200] GET /examples/WebGL_Demo1.html HTTP/1.1 (2825 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
10.0.2.15 - [18/04/2026 13:17:18:536 +0100] [200] GET /examples/jsm/controls/OrbitControls.js HTTP/1.1 (40504 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
10.0.2.15 - [18/04/2026 13:17:18:516 +0100] [200] GET /build/three.module.min.js HTTP/1.1 (364998 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
10.0.2.15 - [18/04/2026 13:17:18:983 +0100] [200] GET /build/three.core.min.js HTTP/1.1 (384222 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
10.0.2.15 - [18/04/2026 13:17:20:218 +0100] [404] GET /favicon.ico HTTP/1.1 (492 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
10.0.2.15 - [18/04/2026 13:17:42:982 +0100] [200] GET /examples/textures/crate.gif HTTP/1.1 (67585 Bytes) :: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0
Last edited: