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;
}