Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/lib/file/vfs/vfs_lookup.h
/* Copyright (C) 2013 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 22 Lines | |||||
class VfsFile; | class VfsFile; | ||||
class VfsDirectory; | class VfsDirectory; | ||||
// note: VfsDirectory pointers are non-const because they may be | // note: VfsDirectory pointers are non-const because they may be | ||||
// populated during the lookup. | // populated during the lookup. | ||||
enum VfsLookupFlags | enum VfsLookupFlags | ||||
{ | { | ||||
// add (if they do not already exist) subdirectory components | // Add (if they do not already exist) subdirectory components | ||||
// encountered in the path[name]. | // encountered in the path[name]. | ||||
// If subdirectores do not exist on disk, they will be created. | |||||
VFS_LOOKUP_ADD = 1, | VFS_LOOKUP_ADD = 1, | ||||
// if VFS directories encountered are not already associated | // Don't populate the directories encountered. This makes sense | ||||
// with a real directory, do so (creating the directories | |||||
// if they do not already exist). | |||||
VFS_LOOKUP_CREATE = 2, | |||||
// don't populate the directories encountered. this makes sense | |||||
// when adding files from an archive, which would otherwise | // when adding files from an archive, which would otherwise | ||||
// cause nearly every directory to be populated. | // cause nearly every directory to be populated. | ||||
VFS_LOOKUP_SKIP_POPULATE = 4, | VFS_LOOKUP_SKIP_POPULATE = 2, | ||||
// even create directories if they are already present, this is | // Perform a 'real path' lookup. | ||||
// useful to write new files to the directory that was attached | // Because the VFS maps multiple 'disk paths' to a single tree of paths, | ||||
// last, if the directory wasn't mounted with VFS_MOUNT_REPLACEABLE | // the 'real directory' of a VFS directory at any given time may be almost anything, | ||||
VFS_LOOKUP_CREATE_ALWAYS = 8 | // in particular not its real parent directory on disk. | ||||
// To make writing predictable, we'll return a path relative to the 'disk path' of the | |||||
// highest priority subdirectory found in the lookup path. | |||||
// See test_vfs_real_paths.h for examples of this behaviour. | |||||
VFS_LOOKUP_REAL_PATH = 4 | |||||
}; | }; | ||||
/** | /** | ||||
* Resolve a pathname. | * Resolve a pathname. | ||||
* | * | ||||
* @param pathname | * @param pathname | ||||
* @param startDirectory VfsStartDirectory. | * @param startDirectory VfsStartDirectory. | ||||
* @param directory is set to the last directory component that is encountered. | * @param directory is set to the last directory component that is encountered. | ||||
Show All 10 Lines |
Wildfire Games · Phabricator