/usr/include/crystalspace-2.0/cstool/smartfileopen.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | /*
Copyright (C) 2007 by Frank Richter
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_CSTOOL_SMARTFILEOPEN_H__
#define __CS_CSTOOL_SMARTFILEOPEN_H__
#include "csutil/ref.h"
struct iFile;
struct iVFS;
namespace CS
{
namespace Utility
{
/**
* "Smartly" try to locate a file given a path that could be: a plain file
* name, directory, name of a level in /lev/, or .zip file.
*
* \a path is tried to be interpreted in a number of different ways:
* - A VFS directory. Succeeds if a file named \a defaultFilename exists
* in the directory.
* - A level name in VFS <tt>/lev/</tt>. Succeeds if a file named
* \a defaultFilename exists below that directory.
* - A <tt>.zip</tt> file name. Succeeds if a file named \a defaultFilename
* exists in the archive.
* - A plain file name. Succeeds if the file exists.
*
* This is for example useful for tool applications which want to let the
* user specify paths and file locations in a variety of ways.
*
* \param vfs The VFS interface to use to open the file.
* \param path The path that is attempted to be opened.
* \param defaultFilename Default filename, used when the provided path
* is a directory or .zip file.
* \param actualFilename Can return the actual filename opened. (Note:
* is either \a defaultFilename or a pointer into \a path).
* \return The file if opening succeeded.
*/
csPtr<iFile> CS_CRYSTALSPACE_EXPORT SmartFileOpen (iVFS* vfs,
const char* path, const char* defaultFilename = 0,
const char** actualFilename = 0);
/**
* "Smartly" change to the directory with some file given a path that could
* be: a plain file name, directory, name of a level in /lev/, or .zip file.
*
* \a path is tried to be interpreted in a number of different ways:
* - A VFS directory. Succeeds if a file named \a defaultFilename exists
* in the directory.
* - A level name in VFS <tt>/lev/</tt>. Succeeds if a file named
* \a defaultFilename exists below that directory.
* - A <tt>.zip</tt> file name. Succeeds if a file named \a defaultFilename
* exists in the archive.
* - A plain file name. Succeeds if the file exists.
*
* This is for example useful for tool applications which want to let the
* user specify paths and file locations in a variety of ways.
*
* \param vfs The VFS interface to use to open the file.
* \param path The path that is attempted to be opened.
* \param defaultFilename Default filename, used to check whether the
* provided path is a directory or .zip file.
* \param actualFilename Can return the filename used to determine the
* directory to change to. (Note: is either \a defaultFilename or a
* pointer into \a path).
* \return Whether the changing the directory succeeded.
*/
bool CS_CRYSTALSPACE_EXPORT SmartChDir (iVFS* vfs,
const char* path, const char* defaultFilename = 0,
const char** actualFilename = 0);
} // namespace Utility
} // namespace CS
#endif // __CS_CSTOOL_SMARTFILEOPEN_H__
|