[QUESTION] Access contents of dropped folder?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[QUESTION] Access contents of dropped folder?
If I drop a folder onto my packed exe how do i access its contents. I don't seem to be able to mount it or read the files in said folder directly. Is there a way to copy the folder into the identity folder when dropped on the exe?
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [QUESTION] Access contents of dropped folder?
A few assumptions;
Did you try using love.directorydropped?
Then inside that callback, you can use love.filesystem.mount to mount it to some virtual path of your choosing.
Did you try using love.directorydropped?
Then inside that callback, you can use love.filesystem.mount to mount it to some virtual path of your choosing.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: [QUESTION] Access contents of dropped folder?
I remember trying that once before to no avail, however it worked this time so thanks.
Re: [QUESTION] Access contents of dropped folder?
It's a shame you cant also mount argument paths, like dragging folder onto the exe. If you know of a solution for that it would be much appreciated. I'll just use the drag n' drop method for now.
Re: [QUESTION] Access contents of dropped folder?
You can access command line arguments from the global arg table:
You can't mount the directory though if it's outside the normally allowed locations. Use this to make that work too:
If that function returns true, the folder contents can be accessed with love.filesystem by using 'thedamnfolder' as the path. If it returns false, something went wrong. To find out what went wrong is left as an excercise for the reader.
Code: Select all
local folder = arg[1] -- get the first argument
Code: Select all
local function mount(path)
local C = ffi.os == 'Windows' and ffi.load('love') or ffi.C
ffi.cdef('int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);')
return C.PHYSFS_mount(path, 'thedamnfolder', 0) ~= 0
end
Last edited by grump on Sat Oct 27, 2018 3:54 am, edited 1 time in total.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: [QUESTION] Access contents of dropped folder?
Or alternatively, you might wait for a few eons util i release my "easy handling" lib that can read from
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests