|
@@ -75,15 +75,15 @@ export class HandbrakeService {
|
|
|
* Returns the actual directory path to use
|
|
* Returns the actual directory path to use
|
|
|
*/
|
|
*/
|
|
|
private ensureOutputDirectory(outputPath: string): string {
|
|
private ensureOutputDirectory(outputPath: string): string {
|
|
|
- const parts = outputPath.split(path.sep);
|
|
|
|
|
- let currentPath = '';
|
|
|
|
|
|
|
+ const isAbsolute = path.isAbsolute(outputPath);
|
|
|
|
|
+ const parts = outputPath.split(path.sep).filter(part => part); // Filter out empty strings
|
|
|
|
|
+ let currentPath = isAbsolute ? '/' : '';
|
|
|
|
|
|
|
|
// Build path incrementally, checking for case-insensitive matches
|
|
// Build path incrementally, checking for case-insensitive matches
|
|
|
for (let i = 0; i < parts.length; i++) {
|
|
for (let i = 0; i < parts.length; i++) {
|
|
|
const part = parts[i];
|
|
const part = parts[i];
|
|
|
- if (!part) continue; // Skip empty parts (e.g., leading slash)
|
|
|
|
|
|
|
|
|
|
- const proposedPath = currentPath ? path.join(currentPath, part) : part;
|
|
|
|
|
|
|
+ const proposedPath = currentPath === '/' ? `/${part}` : path.join(currentPath, part);
|
|
|
|
|
|
|
|
// Check if directory exists (exact case)
|
|
// Check if directory exists (exact case)
|
|
|
if (existsSync(proposedPath)) {
|
|
if (existsSync(proposedPath)) {
|