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