github.com/256dpi/max-go@v0.7.0/lib/max/ext_path.h (about)

     1  // ext_path.h -- path definitions
     2  
     3  #ifndef _EXT_PATH_H_
     4  #define _EXT_PATH_H_
     5  
     6  #include "ext_prefix.h"
     7  #include "ext_common.h"
     8  #include "ext_mess.h"
     9  #include "ext_sysfile.h"
    10  
    11  BEGIN_USING_C_LINKAGE
    12  
    13  #if C74_PRAGMA_STRUCT_PACKPUSH
    14      #pragma pack(push, 2)
    15  #elif C74_PRAGMA_STRUCT_PACK
    16      #pragma pack(2)
    17  #endif
    18  
    19  
    20  /**
    21  	The size you should use when allocating strings for full paths.
    22  	@ingroup files
    23  */
    24  enum {
    25  	MAX_PATH_CHARS = 2048
    26  };
    27  
    28  /**
    29  	The size you should use when allocating strings for filenames.
    30  	At the time of this writing it supports up to 256 UTF chars
    31  	@ingroup files
    32  */
    33  enum {
    34  	MAX_FILENAME_CHARS = 512
    35  };
    36  
    37  typedef short FILE_REF;
    38  
    39  #define PATH_SEPARATOR_CHAR			'/'
    40  #define PATH_SEPARATOR_STRING		"/"
    41  #define SEPARATOR_CHAR				PATH_SEPARATOR_CHAR		// for backwards compatibility
    42  
    43  
    44  /**
    45  	Constants that determine the output of path_nameconform().
    46  	@ingroup files
    47  	@see #e_max_path_types
    48  	@see path_nameconform()
    49  */
    50  typedef enum {
    51  	PATH_STYLE_MAX = 0,			///< use PATH_STYLE_MAX_PLAT
    52  	PATH_STYLE_NATIVE,			///< use PATH_STYLE_NATIVE_PLAT
    53  	PATH_STYLE_COLON,			///< ':'  sep, "vol:"   volume, ":"   relative, "^:" boot
    54  	PATH_STYLE_SLASH,			///< '/'  sep, "vol:/"  volume, "./"  relative, "/"  boot
    55  	PATH_STYLE_NATIVE_WIN		///< '\\' sep, "vol:\\" volume, ".\\" relative, "\\" boot
    56  } e_max_path_styles;
    57  
    58  #ifdef WIN_VERSION 
    59  #define PATH_STYLE_MAX_PLAT			PATH_STYLE_SLASH
    60  #define PATH_STYLE_NATIVE_PLAT		PATH_STYLE_NATIVE_WIN
    61  #else
    62  #define PATH_STYLE_MAX_PLAT			PATH_STYLE_SLASH
    63  #define PATH_STYLE_NATIVE_PLAT		PATH_STYLE_SLASH	// PATH_STYLE_COLON path changes for Max 5-jkc
    64  #endif
    65  
    66  /**
    67  	Constants that determine the output of path_nameconform().
    68  	@ingroup files
    69  	@see #e_max_path_styles
    70  	@see path_nameconform()
    71  */
    72  typedef enum {
    73  	PATH_TYPE_IGNORE = 0,		///< ignore
    74  	PATH_TYPE_ABSOLUTE,			///< absolute path
    75  	PATH_TYPE_RELATIVE,			///< relative path
    76  	PATH_TYPE_BOOT,				///< boot path
    77  	PATH_TYPE_C74,				///< Cycling '74 folder
    78  	PATH_TYPE_PATH,				///< path
    79  	PATH_TYPE_DESKTOP,			///< desktop
    80  	PATH_TYPE_TILDE,			///< "home"
    81  	PATH_TYPE_TEMPFOLDER,		///< /tmp
    82  	PATH_TYPE_USERMAX,			///< ~/Documents/Max 8
    83  	PATH_TYPE_MAXDB,			///< combi: try PATH_TYPE_C74, PATH_TYPE_TILDE, PATH_TYPE_RELATIVE, PATH_TYPE_ABSOLUTE in that order
    84  	PATH_TYPE_PLUGIN,			///< AudioUnit/VST plugin (an .auinfo or .vstinfo file in AppSupport)
    85  	PATH_TYPE_PACKAGE
    86  } e_max_path_types;
    87  
    88  
    89  #define PATH_CHAR_IS_SEPARATOR(c) (((c) == ':') || ((c) == '/') || ((c) == '\\'))
    90  
    91  
    92  /**
    93  	Flags used to represent properties of a file in a #t_fileinfo struct.
    94  	@ingroup files
    95  */
    96  typedef enum {	
    97  	PATH_FILEINFO_ALIAS = 1,	///< alias
    98  	PATH_FILEINFO_FOLDER = 2,	///< folder
    99  	PATH_FILEINFO_PACKAGE = 4	///< package (Mac-only)
   100  } e_max_fileinfo_flags;
   101  
   102  #define FILEINFO_ALIAS		PATH_FILEINFO_ALIAS		// for backwards compatibility
   103  #define FILEINFO_FOLDER		PATH_FILEINFO_FOLDER	// for backwards compatibility
   104  
   105  
   106  /** Flags used by functions such as path_foldernextfile() and path_openfolder().
   107  	@ingroup files
   108  */
   109  typedef enum {	
   110  	PATH_REPORTPACKAGEASFOLDER = 1,	///< if not true, then a Mac OS package will be reported as a file rather than a folder.
   111  	PATH_FOLDER_SNIFF = 2,			///< sniff
   112  	PATH_NOALIASRESOLUTION = 4		///< no alias resolution
   113  } e_max_path_folder_flags;
   114  
   115  
   116  /**
   117  	Permissions or mode with which to open a file.
   118  	@ingroup files
   119  */
   120  typedef enum {	
   121  	PATH_READ_PERM = 1,		///< Read mode
   122  	PATH_WRITE_PERM = 2,	///< Write mode
   123  	PATH_RW_PERM = 3		///< Read/Write mode
   124  } e_max_openfile_permissions;
   125  #define READ_PERM		PATH_READ_PERM		// for backwards compatibility
   126  #define WRITE_PERM		PATH_WRITE_PERM		// for backwards compatibility
   127  #define RW_PERM			PATH_RW_PERM		// for backwards compatibility
   128  
   129  enum {
   130  	PATH_DEFAULT_PATHNAME_COUNT = 16
   131  };
   132  
   133  // indices allow for fast access
   134  typedef enum {	
   135  	PATH_STARTUP_PATH = 0,	
   136  	PATH_SEARCH_PATH,	
   137  	PATH_ACTION_PATH,
   138  	PATH_HELP_PATH
   139  } e_max_path_indices;
   140  
   141  #define STARTUP_PATH	PATH_STARTUP_PATH		// for backwards compatibility
   142  #define SEARCH_PATH		PATH_SEARCH_PATH		// for backwards compatibility
   143  #define ACTION_PATH		PATH_ACTION_PATH		// for backwards compatibility
   144  #define HELP_PATH		PATH_HELP_PATH			// for backwards compatibility
   145  
   146  enum {
   147  	COLLECTIVE_NONE = 0,
   148  	COLLECTIVE_FILECOPY = 1,			// flag for copying an object-used file to support path
   149  	COLLECTIVE_COPYTOMADEFOLDER = 2,	// flag to copying to the folder you made
   150  	COLLECTIVE_EXTRACTTOTEMPFOLDER = 4	// flag to extract to the temp folder (works for collectives, m4l devices, too)
   151  };
   152  
   153  enum {
   154  	TYPELIST_SIZE = 32 //maximum number of types returned
   155  };
   156  
   157  typedef enum {
   158  	TYPELIST_MAXFILES		= 1,
   159  	TYPELIST_EXTERNS		= 2,
   160  	TYPELIST_COLLECTIVES	= 4,
   161  	TYPELIST_MAXFORLIVE		= 8,
   162  	TYPELIST_SNAPSHOTS		= 16,
   163  	TYPELIST_GENPATCHERS	= 32,
   164  	TYPELIST_SNIPPETS		= 64
   165  } e_max_typelists;
   166  
   167  
   168  /**
   169  	Information about a file.
   170  	@ingroup files
   171  */
   172  typedef struct _fileinfo {
   173  	t_fourcc type;			///< type (four-char-code)
   174  	t_fourcc creator;		///< Mac-only creator (four-char-code)
   175  	t_uint32 unused;		///< this was date but it wasn't populated and it wasn't used
   176  	t_int32 flags;			///< One of the values defined in #e_max_fileinfo_flags
   177  } t_fileinfo;
   178  
   179  
   180  /** The path data structure. This struct is provided for debugging convenience, 
   181  	but should be considered opaque and is subject to change without notice. 
   182  	@ingroup files
   183  */
   184  typedef struct _path {	
   185  	void *p_name;		// all we have on Windows, may just be folder name on Mac	
   186  	long p_dirID;		// directory ID on Mac	
   187  	short p_vRefNum;	// volume on Mac	
   188  	short p_wd;			// working directory on the Mac (compatibility mode)
   189  } t_path;
   190  
   191  
   192  /** The pathlink data structure. This struct is provided for debugging convenience, 
   193  	but should be considered opaque and is subject to change without notice. 
   194  	@ingroup files
   195  */
   196  typedef struct _pathlink {
   197  	short l_path;		// index into path table, or p_wd in compatibility mode
   198  	short l_ancestor;	// logical parent, i.e., what path caused this path to be included
   199  	short l_temp;		// used for temporary flag when updating folders
   200  	struct _pathlink *l_next;
   201  	short l_parent;		// true parent folder
   202  	short l_recursive;	// true if is or was added from a parent recursively
   203  	// ddz -- this was not in the kernel -- void *l_watcher;	// watcher to see if this folder changes
   204  } t_pathlink;
   205  
   206  
   207  // flags for t_searchpath
   208  typedef enum {
   209  	PATH_FLAGS_RECURSIVE			= 0x001,
   210  	PATH_FLAGS_READONLY				= 0x010,
   211  	PATH_FLAGS_INCLUDEINCOLLECTIVE	= 0x100
   212  } e_max_searchpath_flags;
   213  
   214  
   215  /**
   216  	Retrieve the Path ID of the Max application.
   217  	@ingroup files
   218  	@return	The path id.
   219  */
   220  short path_getapppath(void);
   221  
   222  short path_getsupportpath(void);
   223  
   224  #ifdef MAC_VERSION
   225  typedef struct FSRef                    FSRef;
   226  
   227  short path_tofsref(C74_CONST short path, C74_CONST char *filename, FSRef *ref);
   228  short path_fromfsref(FSRef *ref); 
   229  #endif // MAC_VERSION
   230  
   231  void path_namefrompathname(char *pathname, char *name);
   232  
   233  
   234  /**
   235  	Find a Max document by name in the search path.
   236  	This routine performs the same function as the routine path_getdefault().
   237  	locatefile() searches through the directories specified by the user for 
   238  	Patcher files and tables in the File Preferences dialog as well as the 
   239  	current default path (see path_getdefault) and the directory
   240  	containing the Max application
   241  	
   242  	@ingroup	files
   243  	@param	name	A C string that is the name of the file to look for.
   244  	@param	outvol	The Path ID containing the location of the file if it is found.
   245  	@param	binflag	If the file found is in binary format (it's of type 'maxb') 1 is returned here; 
   246  					if it's in text format, 0 is returned.
   247  
   248  	@return			If a file is found with the name 
   249  					specified by filename, locatefile returns 0, otherwise it returns non-zero. 
   250  	
   251  	@remark			filename and vol can then be passed to binbuf_read to read and open file the file. 
   252  					When using MAXplay, the search path consists of all subdirectories of 
   253  					the directory containing the MAXplay application. locatefile only 
   254  					searches for files of type 'maxb' and 'TEXT.'
   255  	
   256  	@see			locatefile_extended()
   257  */
   258  short locatefile(C74_CONST char *name, short *outvol, short *binflag);
   259  
   260  
   261  /**
   262  	Find a Max document by name in the search path.
   263  	This function searches through the same directories as locatefile, 
   264  	but allows you to specify a type and creator of your own.
   265  
   266  	@ingroup	files
   267  	@param	name		A C string that is the name of the file to look for.
   268  	@param	outvol		The Path ID containing the location of the file if it is found.
   269  	@param	filetype	The filetype of the file to look for. 
   270  						If you pass 0L, files of all filetypes are considered.
   271  	@param	creator		The creator of the file to look for. If you pass 0L, files with any creator are considered.
   272  	
   273  	@return			If a file is found with the name 
   274  					specified by filename, locatefile returns 0, otherwise it returns non-zero. 
   275  
   276  	@see			locatefile_extended()
   277  */
   278  short locatefiletype(C74_CONST char *name, short *outvol, t_fourcc filetype, t_fourcc creator);
   279  
   280  short locatefilelist(char *name, short *outvol, t_fourcc *outtype, t_fourcc *filetypelist, short numtypes);
   281  
   282  
   283  /**
   284  	Find a file by name. 
   285  	If a complete path is not specified, search for the name in the search path.
   286  	This is the preferred method for file searching since its introduction in Max version 4.
   287  	
   288  	@ingroup	files
   289  	@version	4.0
   290  	
   291  	@param	name			The file name for the search, receives actual filename upon return.
   292  	@param	outvol			The Path ID of the file (if found).
   293  	@param	outtype			The file type of the file (if found).
   294  	@param	filetypelist	The file type(s) for which you are searching for, or NULL if any type is acceptable.
   295  	@param	numtypes		The number of file types in the typelist array (1 if a single entry, 0 if any type is acceptable).
   296  
   297  	@return					If a file is found with the name 
   298  							specified by filename, locatefile returns 0, otherwise it returns non-zero. 
   299  
   300  	@see					path_getdefault().
   301  
   302  	@remark			The old file search routines locatefile() and locatefiletype() 
   303  					are still supported in Max 4, but the use of a new routine 
   304  					locatefile_extended() is highly recommended. However, 
   305  					locatefile_extended() has an important difference from 
   306  					locatefile() and locatefiletype() that may require some rewriting 
   307  					of your code. <em>It modifies its name parameter</em> in certain cases, while 
   308  					locatefile() and locatefiletype() do not. The two cases where it 
   309  					could modify the incoming filename string are 1) when an alias is 
   310  					specified, the file pointed to by the alias is returned; and 2) when a full 
   311  					path is specified, the output is the filename plus the path number of the 
   312  					folder it's in. 
   313  					
   314  					This is important because many people pass the s_name field of a 
   315  					#t_symbol to locatefile(). If the name field of a #t_symbol were to be 
   316  					modified, the symbol table would be corrupted. To avoid this problem, 
   317  					use strncpy_zero() to copy the contents of a #t_symbol to a character string first, 
   318  					as shown below: 
   319  	@code
   320  	char filename[MAX_FILENAME_CHARS]; 
   321  	strncpy_zero(filename,str->s_name, MAX_FILENAME_CHARS); 
   322  	result = locatefile_extended(filename,&path,&type,typelist,1); 
   323  	@endcode
   324  */
   325  short locatefile_extended(char *name, short *outvol, t_fourcc *outtype, C74_CONST t_fourcc *filetypelist, short numtypes);
   326  
   327  short locatefile_pathlist(t_pathlink *list, char *name, short *outvol, t_fourcc *outtype, t_fourcc *filetypelist, short numtypes);
   328  
   329  
   330  /**
   331  	Resolve a Path ID plus a (possibly extended) file name 
   332  	into a path that identifies the file's directory and a filename.
   333  	This routine converts a name and Path ID to a standard form in which 
   334  	the name has no path information and does not refer to an aliased file. 
   335  	
   336  	@ingroup files
   337  	@param	name	A file name (which may be fully or partially qualified), 
   338  					will contain the file name on return.
   339  	@param	path	The Path ID to be resolved.
   340  	@param	outpath	The Path ID of the returned file name.
   341  	
   342  	@return		 	Returns 0 if successful.
   343  */
   344  short path_resolvefile(char *name, C74_CONST short path, short *outpath);
   345  
   346  
   347  /**
   348  	Retrive a #t_fileinfo structure from a file/path combination. 
   349  	
   350  	@ingroup files
   351  	@param	name	The file name to be queried.
   352  	@param	path	The Path ID of the file.
   353  	@param	info	The address of a #t_fileinfo structure to contain the file information.
   354  	
   355  	@return		 	Returns 0 if successful, otherwise it returns an OS-specific error code.
   356  */
   357  short path_fileinfo(C74_CONST char *name, C74_CONST short path, t_fileinfo *info);
   358  
   359  short path_tempfolder(void);
   360  short path_desktopfolder(void);
   361  short path_userdocfolder(void);
   362  short path_usermaxfolder(void);
   363  short path_createfolder(C74_CONST short path, C74_CONST char *name, short *newpath);
   364  
   365  // internal use only -- not exported -- use path_createfolder()
   366  short path_createnewfolder(short path, const char *name, short *newpath);
   367  
   368  short path_copyfile(short srcpath, char *srcname, short dstpath, char *dstname);
   369  short path_copytotempfile(short srcpath, char *srcname, short *outpath, char *outname);
   370  short path_copyfolder(short srcpath, short dstpath, const char *dstname, long recurse, short *newpath);
   371  short C74_MUST_CHECK path_getpath(short path, const char *name, short *outpath);
   372  short path_getname(short path, char *name, short *outpath);
   373  
   374  
   375  /**
   376  	Create a fully qualified file name from a Path ID/file name combination.
   377  	Unlike path_topotentialname(), this routine will only convert a 
   378  	pathname pair to a valid path string if the path exists.
   379  		
   380  	@ingroup files
   381  	@param	path	The path to be used.
   382  	@param	file	The file name to be used.
   383  	@param	name	Loaded with the fully extended file name on return.
   384  	@return		 	Returns 0 if successful, otherwise it returns an OS-specific error code.	
   385  */
   386  short path_topathname(C74_CONST short path, C74_CONST char *file, char *name);
   387  
   388  
   389  /**
   390  	Create a filename and Path ID combination from a fully qualified file name.
   391  	Note that path_frompathname() does not require that the file actually exist. 
   392  	In this way you can use it to convert a full path you may have received as an 
   393  	argument to a file writing message to a form appropriate to provide to 
   394  	a routine such as path_createfile().
   395  		
   396  	@ingroup files
   397  	@param	name		The extended file path to be converted.
   398  	@param	path		Contains the Path ID on return.
   399  	@param	filename	Contains the file name on return.
   400  	@return		 		Returns 0 if successful, otherwise it returns an OS-specific error code.	
   401  */
   402  short path_frompathname(C74_CONST char *name, short *path, char *filename);
   403  
   404  
   405  short path_frompotentialpathname(C74_CONST char *name, short *path, char *filename);
   406  
   407  
   408  void path_splitnames(const char *pathname, char *foldername, char *filename);
   409  short path_getnext(t_pathlink *list, short *val);
   410  
   411  
   412  /**
   413  	Install a path as the default search path.
   414  	The default path is searched before the Max search path. For instance, 
   415  	when loading a patcher from a directory outside the search path, the 
   416  	patcher's directory is searched for files before the search path. 
   417  	path_setdefault() allows you to set a path as the default.
   418  
   419  	@ingroup files
   420  	@param	path		The path to use as the search path.
   421  						If path is already part of the Max Search path, it will not be added 
   422  						(since, by default, it will be searched during file searches).
   423  	@param	recursive	If non-zero, all subdirectories will be installed in the default search list.
   424  						Be very careful with the use of the recursive argument.  It has the capacity to 
   425  						slow down file searches dramatically as the list of folders is being built. 
   426  						Max itself never creates a hierarchical default search path.
   427  */
   428  void path_setdefault(short path, short recursive);
   429  
   430  
   431  /**
   432  	Retrieve the Path ID of the default search path. 
   433  	@ingroup files
   434  	@return	The path id of the default search path.
   435  */
   436  short path_getdefault(void);
   437  
   438  
   439  void path_setdefaultlist(struct _pathlink *list);
   440  
   441  
   442  /**
   443  	Determine the modification date of the selected path.
   444  	
   445  	@ingroup files
   446  	@param	path	The Path ID of the directory to check.
   447  	@param	date	The last modification date of the directory.
   448  	@return			An error code.
   449  */
   450  short path_getmoddate(short path, t_ptr_uint *date);
   451  
   452  
   453  /**
   454  	Determine the modification date of the selected file.
   455  	
   456  	@ingroup files
   457  	@param	filename	The name of the file to query.
   458  	@param	path		The Path ID of the file.
   459  	@param	date		The last modification date of the file upon return.
   460  	@return				An error code.
   461  */
   462  short path_getfilemoddate(C74_CONST char *filename, C74_CONST short path, t_ptr_uint *date);
   463  
   464  
   465  short path_getfiledatesandsize(C74_CONST char *filename, short path, t_uint64 *create, t_uint64 *mod, t_uint64 *access, t_uint64 *size);
   466  
   467  short path_getfilecreationdate(C74_CONST char *filename, C74_CONST short path, t_ptr_uint *date);
   468  short path_getfilesize(char *filename, short path, t_ptr_size *size);
   469  long path_listcount(t_pathlink *list);
   470  
   471  short nameinpath(const char *name, short *ref);					// <-- use path_nameinpath()
   472  short path_nameinpath(C74_CONST char *name, C74_CONST short path, short *ref);
   473  
   474  short path_sysnameinpath(const char *name, short *ref);
   475  
   476  
   477  /**
   478  	Prepare a directory for iteration.
   479  	@ingroup files
   480  	@param	path	The directory Path ID to open.
   481  	@return			The return value of this routine is an internal "folder state" structure 
   482  					used for further folder manipulation. It should be saved and used for 
   483  					calls to path_foldernextfile() and path_closefolder(). 
   484  					If the folder cannot be found or accessed, path_openfolder() returns 0.
   485  */
   486  void *path_openfolder(short path);
   487  
   488  
   489  /**
   490  	Get the next file in the directory.
   491  	In conjunction with path_openfolder() and path_closefolder(), 
   492  	this routine allows you to iterate through all of the files in a path.
   493  
   494  	@ingroup files
   495  	@param	xx			The "folder state" value returned by path_openfolder().
   496  	@param	filetype	Contains the file type of the file type on return.
   497  	@param	name		Contains the file name of the next file on return.
   498  	@param	descend		Unused.
   499  	@return				Returns non-zero if successful, and zero when there are no more files. 
   500  	@see				#e_max_path_folder_flags
   501  */
   502  short path_foldernextfile(void *xx, t_fourcc *filetype, char *name, short descend);
   503  
   504  
   505  /**
   506  	Complete a directory iteration.
   507  	@ingroup files
   508  	@param	x	The "folder state" value originally returned by path_openfolder().
   509  */
   510  void path_closefolder(void *x);
   511  
   512  
   513  short path_renamefile(C74_CONST char *name, C74_CONST short path, C74_CONST char *newname);
   514  long path_getprefstring(long preftype, long index, t_symbol **s);
   515  void path_setprefstring(long preftype, long index, t_symbol *s, long flags, t_symbol *label, short update);
   516  void path_makefromsymbol(long pathtype, t_symbol *sp, short recursive);
   517  
   518  /**
   519  	Open a file given a filename and Path ID.
   520  	
   521  	@ingroup files
   522  	@param	name	The name of the file to be opened.
   523  	@param	path	The Path ID of the file to be opened.
   524  	@param	ref		A #t_filehandle reference to the opened file will be returned in this parameter.
   525  	@param	perm	The permission for the opened file as defined in #e_max_openfile_permissions.
   526  	@return 		An error code.
   527  */
   528  short path_opensysfile(C74_CONST char *name, C74_CONST short path, t_filehandle *ref, short perm);
   529  
   530  
   531  /**
   532  	Create a file given a type code, a filename, and a Path ID.
   533  	
   534  	@ingroup files
   535  	@param	name	The name of the file to be opened.
   536  	@param	path	The Path ID of the file to be opened.
   537  	@param	type	The file type of the created file.
   538  	@param	ref		A #t_filehandle reference to the opened file will be returned in this parameter.
   539  	@return 		An error code.
   540  */
   541  short path_createsysfile(C74_CONST char *name, short path, t_fourcc type, t_filehandle *ref);
   542  
   543  
   544  short path_createressysfile(C74_CONST char *name, C74_CONST short path, t_fourcc type, t_filehandle *ref);
   545  
   546  
   547  /**
   548  	Convert a source path string to destination path string using the specified style and type. 
   549  
   550  	@ingroup files
   551  	@param	src		A pointer to source character string to be converted.
   552  	@param	dst		A pointer to destination character string.
   553  	@param	style	The destination filepath style, as defined in #e_max_path_styles
   554  	@param	type	The destination filepath type, as defined in #e_max_path_types 
   555  	@return			An error code.
   556  	
   557  	@see #MAX_PATH_CHARS
   558  */
   559  short path_nameconform(C74_CONST char *src, char *dst, long style, long type);
   560  
   561  short path_deletefile(C74_CONST char *name, C74_CONST short path);
   562  short path_extendedfileinfo(C74_CONST char *name, short path, t_fileinfo *info, C74_CONST t_fourcc *typelist, short numtypes, short sniff);
   563  short path_getstyle(char *name);
   564  char path_getseparator(char *name);
   565  short path_fileisresource(char *name, short path);
   566  
   567  /**
   568  	Create a fully qualified file name from a Path ID/file name combination, 
   569  	regardless of whether or not the file exists on disk.
   570  	
   571  	@ingroup files
   572  	@param	path	The path to be used.
   573  	@param	file	The file name to be used.
   574  	@param	name	Loaded with the fully extended file name on return.
   575  	@param	check	Flag to check if a file with the given path exists.
   576  	@return		 	Returns 0 if successful, otherwise it returns an OS-specific error code.	
   577  	
   578  	@see path_topathname()
   579  */
   580  short path_topotentialname(C74_CONST short path, C74_CONST char *file, char *name, short check);
   581  
   582  short path_topotentialunicodename(short path, char *file, unsigned short **name, long *outlen, short check);
   583  short path_fromunicodepathname(unsigned short *name, short *path, char *filename, short check);		// if check is non-zero then file must exist
   584  	
   585  /**
   586  	Translates a Max path+filename combo into a correct POSIX absolute path that can be used to pass to libraries 
   587  	and also handles multiple volumes correctly.
   588   
   589  	@ingroup files
   590  	@param	in_path			The Max path reference
   591  	@param	in_filename		The name of the file in that path.
   592  	@param	out_filepath	A string that is MAX_PATH_CHARS in length, which will receive the formatted absolute path upon return.
   593  	@return					Returns 0 if successful.
   594   
   595  	@see path_topotentialname()
   596  	@see path_nameconform()
   597  
   598  	@code
   599  	// example for getting a windows-formatted path for a folder path:
   600  	path_toabsolutesystempath(pathid, "", filestring);
   601  	path_nameconform(filestring, sNativeQualifiedPathname, PATH_STYLE_NATIVE, PATH_TYPE_PATH);
   602  	@endcode
   603  */
   604  t_max_err path_toabsolutesystempath(const short in_path, const char *in_filename, char *out_filepath);
   605  
   606  
   607  /**
   608  	 Convert a path to an absolutepath as done by the absolutepath object in Max.
   609  
   610  	 @ingroup files
   611  	 @param	returned_path	Address to a symbol pointer which will be filled-in upon successful return.
   612  	 @param	s				Incoming (non-absolute) path.
   613  	 @param	filetypelist	The first of an array of file types to limit the search.
   614  	 @param	numtypes		The number of entries in the filetypelist parameter.
   615  	 @return				A Max error code.
   616  
   617  	 @see path_topathname()
   618  	 @see locatefile_extended()
   619   */
   620  t_max_err path_absolutepath(t_symbol **returned_path, const t_symbol *s, const t_fourcc *filetypelist, short numtypes);
   621  
   622  /**
   623  	 Determine if a path/filename combination exists on disk.
   624  
   625  	 @ingroup files
   626  	 @param	path			The Max path reference.
   627  	 @param filename		The name of the file in that path to test.
   628  	 @return				1 = the specified file exists, 0 = the specified file does not exist.
   629  
   630  	 @see path_topathname()
   631  	 @see path_topotentialname()
   632  
   633   */
   634  long path_exists(short path, const char *filename);
   635  void path_addsearchpath(short path, short parent);
   636  void path_addnamed(long pathtype, char *name, short recursive, short permanent);
   637  void path_removefromlist(t_pathlink **list, short parent);
   638  
   639  // private: internal use only
   640  short path_collpathnamefrompath(short vol, short *collvol, char *filename);
   641  char path_inpath(short testvol, short topvol);
   642  
   643  short defvolume(void);			// <--  use path_getdefault()
   644  
   645  
   646  #if C74_PRAGMA_STRUCT_PACKPUSH
   647      #pragma pack(pop)
   648  #elif C74_PRAGMA_STRUCT_PACK
   649      #pragma pack()
   650  #endif
   651  
   652  END_USING_C_LINKAGE
   653  
   654  #endif // _EXT_PATH_H_