Skip to content

Commit

Permalink
add filter files and match khbsd_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostboats committed May 11, 2024
1 parent 420c257 commit d4d5e0e
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions support_files/lslib_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ const { CREATE_LOGGER, raiseError, raiseInfo } = require('./log_utils.js')
const bg3mh_logger = CREATE_LOGGER();

const { getConfig } = require('./config.js');
const { lslibPath, excludedFiles } = getConfig();
const compatRootModPath = path.join(getConfig().rootModPath + "\\");
const lslibPath = path.join(getConfig().lslibPath);
const lslibToolsPath = path.join(getConfig().lslibPath, TOOL_SUBDIR);

const elasticDlls = ['Elastic.Transport.dll', 'Elastic.Clients.Elasticsearch.dll'];
const storyCompilerDll = ['StoryCompiler.dll', 'StoryDecompiler.dll'];
const converterAppDll = ['ConverterApp.dll'];

// the list of directories that need lsx > lsf conversion
const convertDirs = ["[PAK]", "RootTemplates", "MultiEffectInfos", "UI", "GUI", "Effects"];

var DLLS = [];
var DLL_PATHS = [];

Expand Down Expand Up @@ -143,7 +146,6 @@ function LOAD_LSLIB() {
function FIND_FILES(filesPath, targetExt = getFormats().lsf, isRecursive = true) {
let filesToConvert = [];

const { excludedFiles } = getConfig();
const filesList = fs.readdirSync(filesPath, {
withFileTypes: false,
recursive: isRecursive
Expand All @@ -169,6 +171,29 @@ function FIND_FILES(filesPath, targetExt = getFormats().lsf, isRecursive = true)
return filesToConvert;
}


function FILTER_PATHS(filesPath) {
if (Array.isArray(filesPath)) {
let filteredPaths = [];

for (let i = 0; i < filesPath.length; i++) {
filteredPaths.push(FILTER_PATHS(filesPath[i]));
}
return filteredPaths;
}
else if (typeof(filesPath == 'string')) {
let temp_path = filesPath.split(path.sep);

for (let i = 0; i < temp_path.length; i++) {
if (!excludedFiles.includes(temp_path[i]) && convertDirs.includes(temp_path[i])) {
return filesPath;
}
}
}
}



// here in case people (i'm people) have their working directory and their AppData on different hard drives.
function moveFileAcrossDevices(sourcePath, destPath, raiseError) {
fs.readFile(sourcePath, (readErr, data) => {
Expand Down

0 comments on commit d4d5e0e

Please sign in to comment.