From 74d184597e0d41324fab81842249057d07ac290f Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Thu, 19 Nov 2020 21:23:36 -0500 Subject: [PATCH] Don't assume lite lives at the root of the repo --- data | 1 - editor/init.fnl | 2 +- editor/lite.lua | 1 - vendor/lite/main.lua | 22 ++++++++++++++++++---- 4 files changed, 19 insertions(+), 7 deletions(-) delete mode 120000 data delete mode 120000 editor/lite.lua diff --git a/data b/data deleted file mode 120000 index 14e6b7a..0000000 --- a/data +++ /dev/null @@ -1 +0,0 @@ -../lite/data/ \ No newline at end of file diff --git a/editor/init.fnl b/editor/init.fnl index df125c1..52619fc 100644 --- a/editor/init.fnl +++ b/editor/init.fnl @@ -1,4 +1,4 @@ -(require :editor.lite) +(require :vendor.lite.main) (local util (require :lib.util)) (local TileView (require :editor.tileedit)) (local MapEditView (require :editor.mapedit)) diff --git a/editor/lite.lua b/editor/lite.lua deleted file mode 120000 index 3e4601f..0000000 --- a/editor/lite.lua +++ /dev/null @@ -1 +0,0 @@ -../../lite/main.lua \ No newline at end of file diff --git a/vendor/lite/main.lua b/vendor/lite/main.lua index 9515b77..d664c6c 100644 --- a/vendor/lite/main.lua +++ b/vendor/lite/main.lua @@ -233,14 +233,28 @@ function system.fuzzy_match(str, ptn) end table.unpack = unpack + +PATHSEP = package.config:sub(1, 1) ARGS = love.arg.parseGameArguments(arg) VERSION = "1.11" PLATFORM = "love2d" SCALE = love.graphics.getDPIScale() -EXEDIR = "" -PATHSEP = package.config:sub(1, 1) --- love.filesystem.mount(love.filesystem.getSourceBaseDirectory(), love.filesystem.getSourceBaseDirectory()) -package.path = love.filesystem.getWorkingDirectory() .. '/data/?.lua;' .. love.filesystem.getWorkingDirectory() .. '/data/?/init.lua;' .. package.path + +local modname = ... +local ilastdot = modname:reverse():find("%.") +EXEDIR = modname:gsub("%.", PATHSEP) +if ilastdot then + EXEDIR = EXEDIR:sub(1, (-1 - ilastdot)) +else + EXEDIR = "" +end + +local literoot = love.filesystem.getWorkingDirectory() +if #EXEDIR > 0 then + literoot = literoot .. PATHSEP .. EXEDIR +end +package.path = literoot .. '/data/?/init.lua;' .. package.path +package.path = literoot .. '/data/?.lua;' .. package.path function love.run() local core = require('core')