#[unsafe(no_mangle)]pub extern "C" fn dmsc_fs_new_auto() -> *mut CDMSCFileSystemExpand description
Creates a new DMSCFileSystem instance with automatic root directory detection.
Initializes a file system abstraction with automatic detection of the root directory and appropriate platform configuration. The created instance can perform all supported file operations on the local file system.
§Returns
Pointer to newly allocated DMSCFileSystem on success, or NULL if:
- Memory allocation fails
- Root directory detection fails
- Platform initialization fails
§Automatic Detection
The function detects and configures:
- Root Directory: System root (/ on Unix, C:\ on Windows)
- Current Directory: Process current working directory
- Temporary Directory: Platform temp directory location
- Home Directory: User home directory
- Path Separators: Configured based on platform
- Case Sensitivity: Determined by underlying file system
§Initial Capabilities
A newly created file system instance can:
- Perform all path operations
- Access files in any accessible location
- Create and manipulate files and directories
- Query file metadata
§Usage Pattern
DMSCFileSystem* fs = dmsc_fs_new_auto();
if (fs == NULL) {
fprintf(stderr, "File system initialization failed\n");
return ERROR_INIT;
}
// Use file system operations...
dmsc_fs_free(fs);§Platform-Specific Notes
- Windows: Uses backslash path separator, supports UNC paths
- Linux/macOS: Uses forward slash path separator, case-sensitive
- All Platforms: Supports both relative and absolute paths