Skip to content

SoftwareOSIndependence

DavidFreely edited this page Nov 7, 2025 · 27 revisions

Problem

  • UI (***):
    • WPF: The user interface (desktop-user-interface-library from WindowsOS)
  • API (*):
    • WinForms / Microsoft.Win32 / Windows‑APIs: OpenFileDialog, MessageBox, Microsoft.Win32, etc.
    • P/Invoke to Kernel32.dll:
      • Utils.cs declares DllImport("Kernel32.dll") GetSystemTimePreciseAsFileTime <- Works only on Windows.
    • Process.Start
    • System.Drawing.Bitmap requires native libgdiplus library on Linux/macOS <- Which is subject to limitations.
  • Registry‑Accesses
  • Shell‑Conventions
  • Paths:
    • Hard-coded path/path separator assumptions and backslashes (e.g., sys.path.append(os.getcwd() + "\pythonModules")) <- Windows-centric.
    • Hard-coded Windows programs/paths (e.g., the Visual Studio path used to open files)."
    • Python interop (pythonnet): code sets Runtime.PythonDLL to e.g. @"python310" <— library names differ on Linux/macOS (e.g., libpython3.x.so / .dylib).

Needed for OS independence

  • UI switch
    • (Avalonia, .NET MAUI, tkinter, ..)
  • Platform‑abstractions:
    • Cross-platform .NET APIs: like Stopwatch.GetTimestamp() instead of GetSystemTimePreciseAsFileTime.
    • Path.Combine or Path.PathSeparator instead of backslashes.
  • /Platform-conditionalizing:
    • conditional compilation and RuntimeInformation to gate Windows‑specific code:
      • if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { /* win-only */ }

Possability atm

  • WINE (https://www.winehq.org/) for Linux/MacOS
    • (no documentation about it for BS3 yet, your help writing the article is welcome)

Clone this wiki locally