merofeev / docker-windows-volume-watcher

A tool to notify Docker contianers about changes in mounts on Windows.
MIT License
188 stars 30 forks source link

host-mnt can be in different formats #20

Open Bazek opened 3 years ago

Bazek commented 3 years ago

My possible paths are:

/run/desktop/mnt/host/C/some-path
C:\some-path
masquevil commented 3 years ago

Hi @Bazek , do you know how to build this on my local PC? I want to use this~

slippycheeze commented 3 years ago

Hoi. It'd be great if this change, or something similar, was merged into the pypi release. I hit the same issue, because /run/desktop/mnt/host/${drive}/... on my system...

biplobmanna commented 1 year ago

Just came across this issue, and since many systems have different host paths, why not have some sort of flag / arguments passed through cmd while running the program. That way we can also preserve the backwards compatibility, and different paths can also be accommodated?

(my path was in C:/something/something format)

biplobmanna commented 1 year ago

From what I observe, we have 2 cases to consider:

  1. *nix style path of format /some/mnt/or/host/path/ preceding the actual system path eg: /run/desktop/mnt/host/C/some/path/to/the/thing or /host_mnt/C/some/path/to/the/thing

  2. Windows style path, eg: C:\some\path\to\the\thing

Assuming that the path that is passed will always be a valid path (in any format) we can modify the function to include 2 steps:

  1. Check if the path is a proper Windows Style path if so, return original path

  2. Extract only the <drive>/path/to/the/thing from the path provided and convert it into a valid Windows path

This way backwards compatibility will also be maintained, since this case covers the original case of /host_mnt/C/some/path

I will create a PR for this.

sergiu-enache commented 1 year ago

any chance the PR can be merged?

I can manually modify the scripts and it works fine for me, but I'd want to pass this tool for my whole team and I'd hate to tell them to manually apply fix.