mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 16:30:54 +01:00
Add fix_dir_separators util
This commit is contained in:
parent
ecde3e0ce0
commit
e8ca19ba2c
@ -365,20 +365,9 @@ static int add_filename(txtp_header * txtp, char *filename) {
|
||||
}
|
||||
|
||||
|
||||
/* hack to allow relative paths in various OSs */
|
||||
{
|
||||
char c;
|
||||
fix_dir_separators(filename); /* clean paths */
|
||||
|
||||
i = 0;
|
||||
while ((c = filename[i]) != '\0') {
|
||||
if ((c == '\\' && DIR_SEPARATOR == '/') || (c == '/' && DIR_SEPARATOR == '\\'))
|
||||
filename[i] = DIR_SEPARATOR;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* add filesnames */
|
||||
/* add filenames */
|
||||
for (i = range_start; i < range_end; i++){
|
||||
txtp_entry *current;
|
||||
|
||||
|
@ -955,6 +955,17 @@ fail:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* hack to allow relative paths in various OSs */
|
||||
void fix_dir_separators(char * filename) {
|
||||
char c;
|
||||
int i = 0;
|
||||
while ((c = filename[i]) != '\0') {
|
||||
if ((c == '\\' && DIR_SEPARATOR == '/') || (c == '/' && DIR_SEPARATOR == '\\'))
|
||||
filename[i] = DIR_SEPARATOR;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the stream filename is one of the extensions (comma-separated, ex. "adx" or "adx,aix").
|
||||
|
@ -206,6 +206,8 @@ size_t read_string(char * buf, size_t bufsize, off_t offset, STREAMFILE *streamF
|
||||
|
||||
size_t read_key_file(uint8_t * buf, size_t bufsize, STREAMFILE *streamFile);
|
||||
|
||||
void fix_dir_separators(char * filename);
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user