/*
 * OpenVMS File I/O Helper Functions
 * Minimal implementation for IMGMOUNT support
 */

#ifndef DOSBOX_VMS_FILE_H
#define DOSBOX_VMS_FILE_H

#ifdef OPENVMS

#include <stdio.h>
#include <string>

/* Convert DOSBox path to OpenVMS path for file access
 * For IMGMOUNT, we primarily need to handle:
 * - Simple filenames in current directory
 * - Relative paths
 * Returns: OpenVMS-compatible path string
 */
inline std::string vms_translate_path(const std::string& dosbox_path) {
    std::string vms_path = dosbox_path;

    // Simple translation for now:
    // If path contains no directory separators, assume current directory
    if (vms_path.find('/') == std::string::npos &&
        vms_path.find('\\') == std::string::npos) {
        // Simple filename - should work as-is in OpenVMS
        return vms_path;
    }

    // For paths with directories, we'd need more complex translation
    // TODO: Implement full path translation if needed

    return vms_path;
}

/* OpenVMS-safe fopen wrapper */
inline FILE* vms_fopen(const char* filename, const char* mode) {
    std::string vms_path = vms_translate_path(filename);
    return fopen(vms_path.c_str(), mode);
}

#endif /* OPENVMS */

#endif /* DOSBOX_VMS_FILE_H */
