Skip to content

armgit / WSM

Public Imported from GitHub
0

Run macOS applications on your Windows desktop, with a background runtime and integrated app windows.

C++
792 B
Raw Blame
#pragma once
#include <string>

namespace wsm::runtime {
inline std::string qemu_extra_arg(const std::string& value) {
    std::string quoted = "'";
    for (char c : value) quoted += c == '\'' ? "'\\''" : std::string(1, c);
    return quoted + "'";
}
inline std::string qemu_option_path(std::string value) {
    std::string result;
    for (char c : value) {
        if (c == '\\') c = '/';
        result += c;
        if (c == ',') result += ',';
    }
    return result;
}
inline std::string payload_extra_args(const std::string& directory) {
    return "-drive " + qemu_extra_arg("if=none,id=wsmpayload,driver=vvfat,dir=" + qemu_option_path(directory) +
        ",fat-type=16,label=WSMPAYLOAD,read-only=on") +
        " -device usb-storage,bus=xhci.0,drive=wsmpayload,removable=on";
}
}