Skip to content

fix: move the contentDirectory check to come first#1218

Open
WOSSFOSS wants to merge 1 commit intoanidl:masterfrom
WOSSFOSS:patch-1
Open

fix: move the contentDirectory check to come first#1218
WOSSFOSS wants to merge 1 commit intoanidl:masterfrom
WOSSFOSS:patch-1

Conversation

@WOSSFOSS
Copy link

@WOSSFOSS WOSSFOSS commented Mar 7, 2026

Fix #1217

@Sipherdrakon
Copy link
Contributor

Sipherdrakon commented Mar 9, 2026

if all you are looking for is for it to look for the cdm in a different place, then maybe keep the changes specific to that and not reordering the main checks. I only say that because if you set contentDirectory so your CDMs can live somewhere else and then run the GUI build with contentDirectory set then it will be looking in the wrong place for its assets and fail to load the GUI.

I know your main goal is making the CLI work for you but this could have a negative side effect for someone else not using your specific CLI mindset (ie. they also want to have their CDMs in a diff spot, but then want to use the GUI and not the CLI).

So maybe instead just work on the cdm.ts with something like this

const req = new reqModule.Req();

// CDM base: use contentDirectory when set and valid (e.g. Homebrew), else workingDir; fallback avoids bad path
const cdmBase =
	process.env.contentDirectory &&
	(() => {
		try {
			return fs.existsSync(process.env.contentDirectory!) && fs.statSync(process.env.contentDirectory!).isDirectory();
		} catch {
			return false;
		}
	})()
		? process.env.contentDirectory!
		: workingDir;

//read cdm files located in the same directory

and then just make sure to change the stuff that says workingDir to cdmBase and you're good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feedback]: Allow reading Widevine/Playready files from a directory other than the install directory

2 participants