Resolve file path resolution on Mac/Linux.
This commit is contained in:
@@ -8,13 +8,17 @@ const findFileCaseInsensitive = async (
|
||||
): Promise<string | null> => {
|
||||
const directory: string = path.dirname(extensionlessFilePath);
|
||||
try {
|
||||
const matchingFiles = fs
|
||||
.readdirSync(directory)
|
||||
.filter((file: string) =>
|
||||
const matchingFiles = fs.readdirSync(directory).filter((file: string) => {
|
||||
return (
|
||||
extensions.some((ext) =>
|
||||
file.toLowerCase().endsWith(ext.toLowerCase()),
|
||||
),
|
||||
) &&
|
||||
path
|
||||
.basename(file, path.extname(file))
|
||||
.toLowerCase()
|
||||
.startsWith(path.basename(extensionlessFilePath).toLowerCase())
|
||||
);
|
||||
});
|
||||
const files: string[] = [];
|
||||
matchingFiles.forEach((file) => {
|
||||
const fullPath = path.join(directory, file);
|
||||
@@ -33,4 +37,11 @@ const findFileCaseInsensitive = async (
|
||||
return null;
|
||||
};
|
||||
|
||||
const getFilePathWithoutExtension = (filePath: string): string => {
|
||||
return path.join(
|
||||
path.dirname(filePath),
|
||||
path.basename(filePath, path.extname(filePath)),
|
||||
);
|
||||
};
|
||||
|
||||
export { findFileCaseInsensitive };
|
||||
|
||||
@@ -125,9 +125,6 @@ async function ImportJob(filepath: string): Promise<void> {
|
||||
log.info(`Job data saved to: ${filePath}`);
|
||||
}
|
||||
|
||||
//Temporarily adjust the claim number to ensure we are running on the right set of claims.
|
||||
jobObject.clm_no = `ELECTRONAPP-${jobObject.clm_no}`;
|
||||
|
||||
const newAvailableJob: AvailableJobSchema = {
|
||||
uploaded_by: store.get("user.email"),
|
||||
bodyshopid: store.get("app.bodyshop.id"),
|
||||
|
||||
Reference in New Issue
Block a user