[Notepad++] Launch Project From Any File

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Helvecta
Party member
Posts: 167
Joined: Wed Sep 26, 2012 6:35 pm

[Notepad++] Launch Project From Any File

Post by Helvecta » Tue Jan 15, 2019 5:20 am

Howdy :crazy:

For Notepad++ users, here's a quick post about how to launch your LOVE2D project from any open file under that project's directory. In short, no more of this:
Familiar error screen wrote:boot.lua:479: No code to run
Your game might be packaged incorrectly.
Make sure main.lua is at the top level of the zip.
1.) Install Notepad++
2.) Install NppExec through Plugins > Plugins Admin...
3.) Press F6 to execute a command, and paste the following:

Code: Select all

NPP_CONSOLE 0
powershell.exe -command "$path = '$(FULL_CURRENT_PATH)'; $file = 'main.lua'; while($path -and !(Test-Path (Join-Path $path $file))){ if($path -eq ((Split-Path -Path $path -Qualifier)+'\')){ break } else { $path = Split-Path $path -Parent } } & 'C:\Program Files\LOVE\love.exe' $path;"
4.) Click "Save..." and enter a name. Click "Save" to execute and save that script for future use.
5.) From NppExec's advanced options (Plugins > NppExec > Advanced Options...), choose your saved script from the "Associated script:" dropdown, then click "Add/Modify".
6.) Still within NppExec's advanced options, select your newly made entry from the "Menu Items *" section, then check the "Place to the Macros submenu" checkbox.
7.) Restart Notepad++.
8.) From within the shortcut mapping tool (Settings > Shortcut Mapper...), go to the "Plugin commands" tab, then find your entry at the bottom. Assign a shortcut to this entry.

You will now be able to use your new shortcut to launch the project, as long as main.lua is in the current directory or a parent directory. For me, this has proven a more effective method than the wiki's currently recommended solution.
"Bump." -CMFIend420

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 101 guests