script to create shortcut to the LOVE game's save folder

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
sanjiv
Citizen
Posts: 88
Joined: Mon Feb 27, 2012 5:11 am

script to create shortcut to the LOVE game's save folder

Post by sanjiv »

Since love.filesystem contains knowledge about the game's save directory, how would one go about creating a lua script that can generate a shortcut to that directory? It seems like that would save people significant time and energy.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: script to create shortcut to the LOVE game's save folder

Post by Robin »

What do you mean by shortcut?
Help us help you: attach a .love.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

Re: script to create shortcut to the LOVE game's save folder

Post by substitute541 »

As in a .lnk file or similar. (.lnk is Window's shortcut files).
Currently designing themes for WordPress.

Sometimes lurks around the forum.
Zeliarden
Party member
Posts: 139
Joined: Tue Feb 28, 2012 4:40 pm

Re: script to create shortcut to the LOVE game's save folder

Post by Zeliarden »

The shortcut would be saved in the directory that it´s linking to ;)
Just make a shortcut with this in it
%appdata%\LOVE\
or

Code: Select all

function lazy() -- win love dir to clipboard
	savedir = love.filesystem.getSaveDirectory( )
	lovedir = love.filesystem.getAppdataDirectory( ) .. "/LOVE"
		
	success = love.filesystem.write( "clipboard.txt", lovedir)
	--success = love.filesystem.write( "clipboard.txt", "\%appdata%\\LOVE")
	print(lovedir .. " --> clipboard")
	os.execute("CLIP < " .. savedir .. "/clipboard.txt")
end
Zeliarden
Party member
Posts: 139
Joined: Tue Feb 28, 2012 4:40 pm

Re: script to create shortcut to the LOVE game's save folder

Post by Zeliarden »

You can make a Explorer .love shortcut

Code: Select all

function winexplorer() -- opens up win explorer at love save dir
	lovedir = love.filesystem.getAppdataDirectory( ) .. "/LOVE"
	lovedir = string.gsub(lovedir, "/","\\" )	
	os.execute("EXPLORER" .. " " .. lovedir)
	love.event.quit()
end
Attachments
savedir(win).love
opens Explorer at love save dir
(301 Bytes) Downloaded 55 times
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: script to create shortcut to the LOVE game's save folder

Post by Boolsheet »

Note that love.filesystem.getAppdataDirectory returns a UTF-8 encoded string and os.execute may be expecting something different (it's very unlikely that it takes UTF-8 on Windows). Passing the string without modification won't work with paths that have characters outside of ASCII. If you use the %APPDATA% macro instead, then Windows will expand it into the full application data path.
Shallow indentations.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests