Skip to content

Add Windows support #18

@c360e5f1

Description

@c360e5f1

Is your idea related to a problem? Please describe.
Currently this code uses a lot of Linux and macOS specific API calls for reading devices and files, as well as calculating total size of files and filesystems.

Describe the solution you'd like
For example, in fsp.py there are references to O_RDONLY, O_NONBLOCK, and os.SEEK_END, these functions only work in LInux and macOS.

I tested some examples replacing O_NONBLOCK with O_BINARY which works with Windows and was able to successfully upload a VSS volume snapshot.

After digging in the code for a few days, significant portions of fsp.py would need to be rewritten to detect conditions for Linux / macOS and separate functions need to be called for each OS.

For example, here's some psudocode of a new function block that can be used to split off file and filesystem calculations:

def calculateSize(file_path):
    currentPlatform = platform.system()
    match currentPlatform:
        case 'Linux' | 'Darwin':
            files = []
            files.append(file_path)
            validate_file_paths_read(files)
            with os.fdopen(os.open(file_path, os.O_RDONLY | os.O_BINARY), "rb+") as fileHandle: 
            fileHandle.seek(0, os.SEEK_END)
            size = fileHandle.tell()
            os.close(fileHandle)
            return size
        case 'Windows':
            <code for calculating Windows file and filesystem size>
        case _:
            print("Unsupported Platform!")
            return None

Additionally, some extra steps need to be taken on a Windows filesystem to copy the filesystem, such as taking a VSS snapshot of the filesystem and then performing the copy and upload against the VSS snapshot instead of the live filesystem.

I'm going to try to work on it some more but I'm definitely not a coder so this will take a lot of time for me. Some leads that I was pursuing to calculate filesystem size for Windows involve using WMI calls and will need to import the WMI library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions