1 /* 2 * Copyright (C) Volition, Inc. 1999. All rights reserved. 3 * 4 * All source code herein is the property of Volition, Inc. You may not sell 5 * or otherwise commercially exploit the source or things you created based on the 6 * source. 7 * 8 */ 9 10 11 12 #ifndef _CFILESYSTEM_H 13 #define _CFILESYSTEM_H 14 15 #include "cfile/cfile.h" 16 17 // Builds a list of all the files 18 void cf_build_secondary_filelist( const char *cdrom_path ); 19 void cf_free_secondary_filelist(); 20 21 // Internal stuff 22 typedef struct cf_pathtype { 23 int index; // To verify that the CF_TYPE define is correctly indexed into this array 24 const char* path; // Path relative to FreeSpace root, has ending backslash. 25 const char* extensions; // Extensions used in this pathtype, separated by spaces 26 int parent_index; // Index of this directory's parent. Used for creating directories when writing. 27 } cf_pathtype; 28 29 // During cfile_init, verify that Pathtypes[n].index == n for each item 30 extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES]; 31 32 bool cf_check_location_flags(uint32_t check_flags, uint32_t desired_flags); 33 34 // Returns the default storage path for files given a 35 // particular pathtype. In other words, the path to 36 // the unpacked, non-cd'd, stored on hard drive path. 37 // If filename isn't null it will also tack the filename 38 // on the end, creating a completely valid filename. 39 // Input: pathtype - CF_TYPE_?? 40 // path_max - Maximum characters in the path 41 // filename - optional, if set, tacks the filename onto end of path. 42 // Output: path - Fully qualified pathname. 43 //Returns 0 if result would be too long (invalid result) 44 int cf_create_default_path_string(char* path, uint path_max, int pathtype, const char* filename = nullptr, 45 bool localize = false, uint32_t location_flags = CF_LOCATION_ALL); 46 int cf_create_default_path_string(SCP_string& path, int pathtype, const char* filename = nullptr, bool localize = false, 47 uint32_t location_flags = CF_LOCATION_ALL); 48 49 #endif //_CFILESYSTEM_H 50