mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-02-17 19:19:16 +01:00
Add helper functions to get file name/path/ext
This commit is contained in:
parent
d592199d6f
commit
0a39d7636e
@ -553,3 +553,29 @@ int find_chunk(STREAMFILE *streamFile, uint32_t chunk_id, off_t start_offset, in
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_streamfile_name(STREAMFILE *streamFile, char * buffer, size_t size) {
|
||||
streamFile->get_name(streamFile,buffer,size);
|
||||
return 1;
|
||||
}
|
||||
int get_streamfile_path(STREAMFILE *streamFile, char * buffer, size_t size) {
|
||||
const char *path;
|
||||
|
||||
streamFile->get_name(streamFile,buffer,size);
|
||||
|
||||
path = strrchr(buffer,DIR_SEPARATOR);
|
||||
if (path!=NULL) path = path+1; /* includes "/" */
|
||||
|
||||
if (path) {
|
||||
buffer[path - buffer] = '\0';
|
||||
} else {
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
int get_streamfile_ext(STREAMFILE *streamFile, char * filename, size_t size) {
|
||||
streamFile->get_name(streamFile,filename,size);
|
||||
strcpy(filename, filename_extension(filename));
|
||||
return 1;
|
||||
}
|
||||
|
@ -159,4 +159,8 @@ int check_extensions(STREAMFILE *streamFile, const char * cmp_exts);
|
||||
int find_chunk_be(STREAMFILE *streamFile, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size);
|
||||
int find_chunk_le(STREAMFILE *streamFile, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size);
|
||||
int find_chunk(STREAMFILE *streamFile, uint32_t chunk_id, off_t start_offset, int full_chunk_size, off_t *out_chunk_offset, size_t *out_chunk_size, int size_big_endian, int zero_size_end);
|
||||
|
||||
int get_streamfile_name(STREAMFILE *streamFile, char * buffer, size_t size);
|
||||
int get_streamfile_path(STREAMFILE *streamFile, char * buffer, size_t size);
|
||||
int get_streamfile_ext(STREAMFILE *streamFile, char * filename, size_t size);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user