lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Thijs,

> I had just devised the following workaround; replace the full path by its short version;
> So I wouldn't have to quote the command itself. But yours is better and universally
> applicable (I can monkeypatch os.execute() with that, and rest assured it works
> everywhere).

If you don't mind using an external module, then winapi provides
short_path function that returns proper short path for a filename:

  require("winapi")
  winapi.set_encoding(winapi.CP_UTF8)
  filepath = winapi.short_path(filepath)

I do like Peter's clever solution though.

Paul.