[Notepad++] Launch Project From Any File

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
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

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

User avatar
Posts: 33
Joined: Thu Oct 03, 2019 5:57 pm
Location: Kazakhstan

Re: [Notepad++] Launch Project From Any File

Post by YounYokel » Sun Oct 06, 2019 1:59 pm

I don't think it's a problem, but I'm gonna mention that when you use a function — love.filesystem.getWorkingDirectory() — it shows the Notepad++ path. And it doesn't work with running the console

One thing you can add in "Execute" option is this at the begging:

Code: Select all

It will save the current file immediately after pressing whatever button you managed to run the Love2D.
Last edited by YounYokel on Thu Dec 05, 2019 6:57 pm, edited 3 times in total.
Let's make games with love.

Code: Select all

string.format('Made with LÖVE %s.%s (%s)', ({love.getVersion()})[1], ({love.getVersion()})[2], ({love.getVersion()})[4])

User avatar
Party member
Posts: 1606
Joined: Fri Mar 07, 2008 1:39 pm

Re: [Notepad++] Launch Project From Any File

Post by ivan » Sun Oct 06, 2019 6:24 pm

This is a great idea!
Here is my version using just Lua/Love2d (without NppExec):

1.) Download "ezload.love" and save it somewhere
2.) Install Notepad++
3.) Press F5 and enter the command:

Code: Select all

C:\path\to\love.exe C:\path\to\ezload.love -console -fused "$(FULL_CURRENT_PATH)"
Note that "-console" and "-fused" are optional (and make sure to use one dash "-" instead of two "--")
4.) Click "Save..." and enter a name. Click "Save" to execute and save that script for future use.

That's it!
Notepad++ will automatically find and run your project based on the current file you are editing.
(677 Bytes) Downloaded 96 times

Post Reply

Who is online

Users browsing this forum: pirogronian and 12 guests