On Sun, Mar 15, 2020 at 10:48 AM Jeffrey Walton wrote: > > On Sun, Mar 15, 2020 at 9:59 AM Bob Friesenhahn > wrote: > > > > On Sun, 15 Mar 2020, Jeffrey Walton wrote: > > ... > Maybe libtool can do the same. Supply a small C program, compile it > and call it from the libtool scripts. Its would be quite easy to > supply the path in argv[1], and get back either (1) the original name > (no spaces), (2) a short file name or (3) a quoted long file name. If > the path gets split and shows up in pieces across argv[1]...argv[n-1], > then just combine the pieces because you know what is supposed to > happen. Bob, see what you think about a program like the one attached. The C code will be messier, but it is the same concept. Here's what it returns during testing. The -c options means returns string to use as a C declare. With USE_WINDOWS_API (tested under MSYS): $ ./quote_path.exe "C:\Users\Jeffrey" "Walton\Desktop" C:\Users\JEFFRE~1\Desktop $ ./quote_path.exe -c "C:\Users\Jeffrey" "Walton\Desktop" "C:\\Users\\JEFFRE~1\\Desktop"; $ ./quote_path.exe -c C:\\Users C:\\Users Without USE_WINDOWS_API (tested under MSYS): $ ./quote_path.exe "C:\Users\Jeffrey" "Walton\Desktop" "C:\Users\Jeffrey Walton\Desktop" $ ./quote_path.exe -c "C:\Users\Jeffrey" "Walton\Desktop" "\"C:\\Users\\Jeffrey Walton\\Desktop\""; $ ./quote_path.exe C:\\Users\\Jeffrey Walton\\Desktop "C:\Users\Jeffrey Walton\Desktop" $ ./quote_path.exe -c C:\\Users\\Jeffrey Walton\\Desktop "\"C:\\Users\\Jeffrey Walton\\Desktop\""; $ ./quote_path.exe -c C:\\Users C:\\Users I think offloading to an external program written for the specific problem will probably simplify libtool and its helpers. It will make your life a lot easier. Jeff