mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
42 lines
2.0 KiB
C
42 lines
2.0 KiB
C
//===== Copyright © 2005-2005, Valve Corporation, All rights reserved. ======//
|
|
//
|
|
// Purpose: Helper methods + classes for file access.
|
|
//
|
|
//===========================================================================//
|
|
#ifndef FILEUTILS_H
|
|
#define FILEUTILS_H
|
|
|
|
#if defined( _WIN32 )
|
|
#pragma once
|
|
#endif
|
|
#include "filesystem/filesystem.h"
|
|
|
|
// Builds a directory which is a subdirectory of the current mod.
|
|
void GetModSubdirectory( const char *pSubDir, char *pBuf, size_t nBufLen );
|
|
|
|
// Builds a directory which is a subdirectory of the current mod's *content*.
|
|
void GetModContentSubdirectory( const char *pSubDir, char *pBuf, size_t nBufLen );
|
|
|
|
// Generates a filename under the 'game' subdirectory given a subdirectory of 'content'.
|
|
void ComputeModFilename( const char *pContentFileName, char *pBuf, size_t nBufLen );
|
|
|
|
// Generates a filename under the 'content' subdirectory given a subdirectory of 'game'.
|
|
void ComputeModContentFilename( const char *pGameFileName, char *pBuf, size_t nBufLen );
|
|
|
|
// Finds all files matching the a name within a directory and its sub directories. Output entries are paths to found files (relative to and including szStartDirectory).
|
|
void RecursiveFindFilesMatchingName( CUtlVector< CUtlString > *pOutFileList, const char* szStartDirectory, const char* szTargetFileName, const char *pPathID );
|
|
|
|
// Builds a list of all files under a directory with a particular extension.
|
|
void AddFilesToList( CUtlVector< CUtlString > &list, const char *pDirectory, const char *pPath = nullptr, const char *pExtension = nullptr );
|
|
|
|
// Returns the search path as a list of paths.
|
|
void GetSearchPath( CUtlVector< CUtlString > &path, const char *pPathID );
|
|
|
|
// Given file name generate a full path using the following rules.
|
|
// 1. if its full path already return.
|
|
// 2. if its a relative path try to find it under the path id.
|
|
// 3. if find fails treat relative path as relative to the current dir.
|
|
bool GenerateFullPath( const char *pFileName, char const *pPathID, char *pBuf, size_t nBufLen );
|
|
|
|
#endif // FILEUTILS_H
|