Skip to content

Commit

Permalink
resolves Issue-33
Browse files Browse the repository at this point in the history
Co-authored-by: Josh <[email protected]>
  • Loading branch information
ChristophLHR and ColdIV committed Dec 3, 2023
1 parent 1388dff commit cb3cd8b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
12 changes: 6 additions & 6 deletions libs/scm/net.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ do
.. config()[sourceObject.type .. "Suffix"]
.. "/" .. filePaths[i], "w")
end
tmpfile.write(tmpContent)
tmpfile.close()
tmpFile.write(tmpContent)
tmpFile.close()
else
success = false
end
Expand All @@ -176,10 +176,10 @@ do
-- create a link that calls the file within the program directory
if sourceObject.type == "program" then
local progamLink = fs.open(sourceObject.name, "w")
progamLink:write("shell.execute(\"" .. targetDirectory .. sourceObject.name ..
progamLink.write("shell.execute(\"" .. targetDirectory .. sourceObject.name ..
config()[sourceObject.type .. "Suffix"]
.. "/" .. sourceObject.name .. ".lua" .. "\", ...)")
progamLink:close()
progamLink.close()
elseif sourceObject.type == "library" then
local libraryLink = fs.open(targetDirectory .. sourceObject.name .. ".lua", "w")
if not libraryLink then
Expand All @@ -192,10 +192,10 @@ do
tmpName = tmpName:match("(.+)%..+$")
end

libraryLink:write("return require(\"./" .. config()["libraryDirectory"]
libraryLink.write("return require(\"./" .. config()["libraryDirectory"]
.. tmpName .. config()[sourceObject.type .. "Suffix"]
.. "/" .. tmpName .. "\")")
libraryLink:close()
libraryLink.close()
end

return sourceObject, true
Expand Down
10 changes: 7 additions & 3 deletions libs/scm/scriptManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ do
end

-- delete file
if scriptType and fs.exists(config()[scriptType .. "Directory"] .. name .. ".lua") then
fs.delete(config()[scriptType .. "Directory"] .. name .. config()[scriptType .. "Suffix"])
local scriptDir = config()[scriptType .. "Directory"]
if scriptType and (
fs.exists(scriptDir .. name .. ".lua") or
fs.exists(scriptDir .. name .. config()[scriptType .. "Suffix"])
) then
fs.delete(scriptDir .. name .. config()[scriptType .. "Suffix"])
if scriptType == "library" then
fs.delete(config()[scriptType .. "Directory"] .. name .. ".lua")
fs.delete(scriptDir .. name .. ".lua")
end
end

Expand Down
12 changes: 6 additions & 6 deletions scm.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---@class SCM
SCM = {}
require('libs.scm.config')
require('libs.scm.net')
require('libs.scm.log')
require('libs.scm.scriptManager')
require('libs.scm.autocomplete')
require('libs.scm.ui')
require('./libs.scm.config')
require('./libs.scm.net')
require('./libs.scm.log')
require('./libs.scm.scriptManager')
require('./libs.scm.autocomplete')
require('./libs.scm.ui')

function SCM:checkVersion()
if not self.Config.config["updateAvailable"] and self.Config.config["lastVersionCheck"] ~= '' .. os.day("utc") then
Expand Down

0 comments on commit cb3cd8b

Please sign in to comment.