Weird require name resolution bug?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Weird require name resolution bug?

Post by parallax7d »

I recently changed one of my module names from camelCase to lowercase ( infoScreen.lua > infoscreen.lua )
As usual, I didn't change my code from

Code: Select all

local infoScreen = require 'infoScreen'
to the correct

Code: Select all

local infoscreen = require 'infoscreen'
Obviously, when I zipped the code into a .love file and double clicked on it (I'm on mac os 10.6) it errored out, saying that infoScreen couldn't be found. Same deal if I ran the following command while in ~

Code: Select all

/Applications/love.app/Contents/MacOS/love /Users/parallax7d/builds/noerror.love
This is all well and good and expected of course.

But here is the weird thing - If I changed my shell's working directory to my code directory, where this project lives, and executed the above shell command, it would actually run without throwing an error! If I ran that command from any other directory it would error like normal. Did I find a lua/love bug?
Attachments
noerror.zip
(464 Bytes) Downloaded 150 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Weird require name resolution bug?

Post by Robin »

This is expected behavior, depending on the filesystem your game project is stored. Some filesystems are just case insensitive, and LÖVE can't really do anything but accept the situation.
Help us help you: attach a .love.
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: Weird require name resolution bug?

Post by parallax7d »

Using Journaled HFS+ which is case insensitive, so that must be it. But file names do preserve case, so there is a real difference between infoscreen and infoScreen. I would have hoped lua/love would take that into consideration, but since it's an edge case I won't worry about it too much, and give some extra leeway when it comes to file caps. thanks!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Weird require name resolution bug?

Post by Nixola »

LÖVE doesn't handle the file directly, it has to ask for "infoScreen.lua"; if whatever's in charge of looking into the FS and get the file doesn't care and returns the content or the address or something of "infoscreen.lua" when LÖVE asks for "infoScreen.lua", nothing can be done.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Re: Weird require name resolution bug?

Post by parallax7d »

Any idea why it only ignores case only when I launch it from my home directory?
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 111 guests