rework index builder, add pro ffmpeg format
[goodguy/history.git] / cinelerra-5.1 / cinelerra / preferences.C
index 0eca68eb76919e43390d05f09904159a449efc16..a3f3b391f3062f05fe988b9ec14c0943d9b38680 100644 (file)
@@ -698,18 +698,16 @@ int Preferences::get_node_port(int number)
 int Preferences::get_asset_file_path(Asset *asset, char *path)
 {
        strcpy(path, asset->path);
-       int result = access(path, R_OK);
+       int result = !access(path, R_OK) ? 0 : -1;
        if( !result && asset->format == FILE_MPEG ) {
-               char source_filename[BCTEXTLEN];
-               char index_filename[BCTEXTLEN];
+               char source_filename[BCTEXTLEN], index_filename[BCTEXTLEN];
                IndexFile::get_index_filename(source_filename,
-                       index_directory, index_filename,
-                       asset->path, ".toc");
-               struct stat st;
-               if( !access(index_filename, R_OK) &&
-                   !stat(index_filename,&st) && st.st_size > 0 )
+                       index_directory, index_filename, asset->path, ".toc");
                strcpy(path, index_filename);
+               if( access(path, R_OK) )
+                       result = 1;
        }
+// result = 0, asset->path/toc exist, -1 no asset, 1 no toc
        return result;
 }