Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
hotfix: issue with plugin updater
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanctech committed Jul 28, 2021
1 parent a851a73 commit abc5200
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
4 changes: 0 additions & 4 deletions sonorancad/core/plugin_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ local function downloadPlugin(name, url)
exports[GetCurrentResourceName()]:UnzipFolder(savePath, unzipPath)
os.remove(savePath)
infoLog(("Plugin %s successfully downloaded."):format(name))
local result = exports[GetCurrentResourceName()]:DeleteDirectoryRecursively(movePath)
if not result then
errorLog("Failed to delete plugin stream folder before moving updated version.")
end
PluginsWereUpdated = true
else
if not Config.enableCanary then
Expand Down
15 changes: 15 additions & 0 deletions sonorancad/core/unzipper/unzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,28 @@ exports('UnzipFile', (file, dest) => {
fs.createReadStream(file).pipe(unzipper.Extract({ path: dest}));
});

function deleteDirR(dir) {
fs.rmdir(dir, {recursive:true}, (err) => {
if (err) {
console.log(err)
return false, err;
}
});
return true;
}

exports('UnzipFolder', (file, name, dest) => {
let firstDir = null;
let hasStreamFolder = false;
fs.createReadStream(file).pipe(unzipper.Parse())
.on('entry', function(entry) {
var fileName = entry.path;
const type = entry.type;
if (type == "Directory") {
if (fileName.contains("stream")) {
hasStreamFolder = true;
deleteDirR(`${GetResourcePath(GetCurrentResourceName())}/stream/${name}/`);
}
if (firstDir == null) {
firstDir = fileName;
}
Expand Down
2 changes: 1 addition & 1 deletion sonorancad/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ games {'gta5'}

author 'Sonoran CAD'
description 'Sonoran CAD FiveM Integration'
version '2.6.4'
version '2.6.5'

server_scripts {
'core/http.js'
Expand Down
2 changes: 1 addition & 1 deletion sonorancad/version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"resource" : "2.6.4",
"resource" : "2.6.5",
"testedFxServerVersion": "4162"
}

0 comments on commit abc5200

Please sign in to comment.