lua-users home
lua-l archive

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


> and if the underlying OS use case-sensitive file path, you wouldn't get the file loaded
> at the first place if your package.path don't match the directory path in the fs.
>
> this is just my personal opinion; I don't quite get the exact problem you encountered.

The problem is that in the IDE I load the script using the full
correct name and all the breakpoints are set using the correct name.
But in the debugger the path is returned as package.path (using
whatever spelling was provided in the script) and the module name and
the two paths don't match (as I have no control over how this is
specified in the script).

I've converted both to lowercase on windows for now, but would like to
know if this is the expected workaround. Ideally, I'd prefer getinfo
to return a normalized path, rather than package.path + module name.

Paul.

On Sat, Sep 22, 2012 at 10:20 PM, Peng Zhicheng
<pengzhicheng1986@gmail.com> wrote:
> 于 2012-9-23 12:50, Paul K 写道:
>
> Hi All,
>
> I came across this subtle issue, which creates problems for handling
> breakpoints in the debugger I'm working on. I put a workaround in
> place, but I'd like to know if this is something expected or if it is
> something that may need to be fixed in Lua.
>
> On windows the "old" file systems (FAT) is case-insensitive, but
> case-preserving. NTFS is case-sensitive, but it also seems to provide
> a mode of operation that is case-insensitive, but case-preserving
> (possibly for compatibility purposes); there are some details in this
> article: http://support.microsoft.com/kb/100625.
>
> How does all this matter? If I have a folder 'c:\foo' (lowercase), but
> specify package.path = "C:\FOO\?.lua" and try to load file
> "c:\foo\bar.lua" (using require "bar"), on a case sensitive system the
> command fails, but on a case-insensitve, but case-preserving system it
> will be successful. Unfortunately, Lua then seems to report the name
> of the file (in debug.getinfo) as "C:\FOO\bar.lua" (as specified in
> package.path), rather than "C:\foo\bar.lua" (as this path exists in
> the file system), which creates problems in matching the two names.
>
> I know, the likely recommendation is "don't do it", but this is a real
> case from real users who ran into this issue.
>
> Would it make sense to use the case-sensitive mode on windows or
> possibly normalize the path before reporting it through debug.getinfo?
>
> Paul.
>
> ZeroBrane Studio - slick Lua IDE and debugger for Windows, OSX, and
> Linux - http://studio.zerobrane.com/
>
>
> Lua just concatenates package.path and the module name(with dots substituted
> by path seperator)
> to get the file name to load, and passed that to the OS.
>
> since the OS API would accept the file path, I don't think there would be
> much trouble when you
> wanted to use that path too, since you would use the very same API of the
> OS.
>
> and if the underlying OS use case-sensitive file path, you wouldn't get the
> file loaded
> at the first place if your package.path don't match the directory path in
> the fs.
>
>
> this is just my personal opinion; I don't quite get the exact problem you
> encountered.
> what do you say?
>
> best regards.