add a check on project file open

pull/1496/head
Mikael Finstad 3 years ago
parent 370e37777b
commit 56eec1fa3f
No known key found for this signature in database
GPG Key ID: 25AB36E3E81CBC26

@ -531,6 +531,7 @@
"The audio track is not supported. You can convert to a supported format from the menu": "The audio track is not supported. You can convert to a supported format from the menu.",
"The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.": "The file name template is missing {{ext}} and will result in a file without the suggested extension. This may result in an unplayable output file.",
"The last executed ffmpeg commands will show up here after you run operations. You can copy them to clipboard and modify them to your needs before running on your command line.": "The last executed ffmpeg commands will show up here after you run operations. You can copy them to clipboard and modify them to your needs before running on your command line.",
"The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}": "The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}",
"The media you tried to open does not exist": "The media you tried to open does not exist",
"The size of the merged output file ({{outputFileTotalSize}}) differs from the total size of source files ({{sourceFilesTotalSize}}) by more than {{maxDiffPercent}}%. This could indicate that there was a problem during the merge.": "The size of the merged output file ({{outputFileTotalSize}}) differs from the total size of source files ({{sourceFilesTotalSize}}) by more than {{maxDiffPercent}}%. This could indicate that there was a problem during the merge.",
"The video inside segments will be discarded, while the video surrounding them will be kept.": "The video inside segments will be discarded, while the video surrounding them will be kept.",

@ -1305,7 +1305,7 @@ const App = memo(() => {
const storeProjectInSourceDir = !storeProjectInWorkingDir;
async function tryOpenProject({ chapters, cod }) {
async function tryFindAndLoadProjectFile({ chapters, cod }) {
try {
// First try to open from from working dir
if (await tryOpenProjectPath(getEdlFilePath(fp, cod), 'llc')) return;
@ -1413,7 +1413,7 @@ const App = memo(() => {
if (projectPath) {
await loadEdlFile({ path: projectPath, type: 'llc' });
} else {
await tryOpenProject({ chapters: fileMeta.chapters, cod });
await tryFindAndLoadProjectFile({ chapters: fileMeta.chapters, cod });
}
// throw new Error('test');
@ -1471,12 +1471,20 @@ const App = memo(() => {
console.log('Loading LLC project', path);
const project = await loadLlcProject(path);
const { mediaFileName } = project;
console.log({ mediaFileName });
if (!mediaFileName) return;
projectPath = path;
const mediaFilePath = pathJoin(dirname(path), mediaFileName);
// Note: MAS only allows fs.stat (fs-extra.exists) if we don't have access to input dir yet
if (!(await exists(mediaFilePath))) {
errorToast(i18n.t('The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}', { mediaFileName }));
return;
}
projectPath = path;
// We might need to get user's access to the project file's directory, in order to read the media file
try {
await ensureAccessToSourceDir(mediaFilePath);

Loading…
Cancel
Save