Cross-Platform File Storage Configuration
If you're running FabrCore on WSL or Linux, you may encounter an unexpected directory creation issue. Here's the fix.
The Issue
FabrCore's default FileStorageSettings.StoragePath is hardcoded to c:\temp\fabrcorefiles. On Windows, this resolves to the expected directory on the C: drive. On Linux and WSL, however, .NET doesn't interpret this as a Windows path — it treats it as a relative path and creates a literal directory named c:\temp\fabrcorefiles in your current working directory.
You'll notice this when you see a strangely named folder appear in your project root, or when file storage operations write to an unexpected location. The application still works — files are stored and retrieved — but they're not where you'd expect them to be.
The Fix
Override the default by configuring StoragePath in your appsettings.json:
{
"FileStorage": {
"StoragePath": "/tmp/fabrcorefiles",
"DefaultTtlSeconds": 300,
"CleanupIntervalMinutes": 1
}
}
The DefaultTtlSeconds controls how long stored files persist before automatic cleanup, and CleanupIntervalMinutes sets the frequency of the background cleanup sweep. These are independent of the path issue but worth configuring at the same time.
Cross-Platform Configuration
Here are the recommended storage paths for each platform:
| Platform | Recommended StoragePath |
|---|---|
| Windows | C:\\temp\\fabrcorefiles |
| Linux / WSL | /tmp/fabrcorefiles |
| macOS | /tmp/fabrcorefiles |
If you need a single configuration that works across all platforms, you can use an environment variable approach in your application startup code:
var storagePath = Path.Combine(Path.GetTempPath(), "fabrcorefiles");
builder.Configuration["FileStorage:StoragePath"] = storagePath;
Path.GetTempPath() returns the platform-appropriate temporary directory — C:\Users\{user}\AppData\Local\Temp\ on Windows, /tmp/ on Linux and macOS. Combined with Path.Combine, this produces a valid absolute path on any platform without conditional logic.
Status
This is a known issue with the current default value. A fix to use Path.Combine(Path.GetTempPath(), "fabrcorefiles") as the default is planned for a future release, so the hardcoded Windows path will be replaced with platform-aware resolution out of the box.
Until then, explicitly setting StoragePath in your configuration is the recommended workaround. For more on FabrCore's configuration system, see the configuration documentation.
Builder of FabrCore and OpenCaddis.