remove ExtractFilePath() ExtractFileBase() ExtractFileExtension()
This commit is contained in:
parent
82d038f6d1
commit
3960adf898
|
|
@ -256,7 +256,7 @@ inline TextOutputStreamType& ostream_write( TextOutputStreamType& outputStream,
|
||||||
|
|
||||||
template<typename TextOutputStreamType>
|
template<typename TextOutputStreamType>
|
||||||
TextOutputStreamType& ostream_write( TextOutputStreamType& t, const Vector4& v ){
|
TextOutputStreamType& ostream_write( TextOutputStreamType& t, const Vector4& v ){
|
||||||
return t << "[ " << v.x() << " " << v.y() << " " << v.z() << " " << v.w() << " ]";
|
return t << "[ " << v.x() << ' ' << v.y() << ' ' << v.z() << ' ' << v.w() << " ]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1167,7 +1167,7 @@ inline void matrix4_pivoted_transform_by_euler_xyz_degrees( Matrix4& self, const
|
||||||
|
|
||||||
template<typename TextOutputStreamType>
|
template<typename TextOutputStreamType>
|
||||||
inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const Matrix4& m ){
|
inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const Matrix4& m ){
|
||||||
return ostream << m.x() << " " << m.y() << " " << m.z() << " " << m.t();
|
return ostream << m.x() << ' ' << m.y() << ' ' << m.z() << ' ' << m.t();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@
|
||||||
#include "inout.h"
|
#include "inout.h"
|
||||||
#include "qstringops.h"
|
#include "qstringops.h"
|
||||||
#include "qpathops.h"
|
#include "qpathops.h"
|
||||||
|
#include "stream/stringstream.h"
|
||||||
|
#include "stream/textstream.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
@ -78,33 +80,25 @@ char *ex_argv[MAX_EX_ARGC];
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
void ExpandWildcards( int *argc, char ***argv ){
|
void ExpandWildcards( int *argc, char ***argv ){
|
||||||
struct _finddata_t fileinfo;
|
struct _finddata_t fileinfo;
|
||||||
int handle;
|
|
||||||
int i;
|
|
||||||
char filename[1024];
|
|
||||||
char filepath[1024];
|
|
||||||
char *path;
|
|
||||||
|
|
||||||
ex_argc = 0;
|
ex_argc = 0;
|
||||||
for ( i = 0 ; i < *argc ; i++ )
|
for ( int i = 0 ; i < *argc ; i++ )
|
||||||
{
|
{
|
||||||
path = ( *argv )[i];
|
char *path = ( *argv )[i];
|
||||||
if ( path[0] == '-'
|
if ( path[0] == '-'
|
||||||
|| ( !strchr( path, '*' ) && !strchr( path, '?' ) ) ) {
|
|| ( !strchr( path, '*' ) && !strchr( path, '?' ) ) ) {
|
||||||
ex_argv[ex_argc++] = path;
|
ex_argv[ex_argc++] = path;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = _findfirst( path, &fileinfo );
|
const int handle = _findfirst( path, &fileinfo );
|
||||||
if ( handle == -1 ) {
|
if ( handle == -1 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractFilePath( path, filepath );
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sprintf( filename, "%s%s", filepath, fileinfo.name );
|
ex_argv[ex_argc++] = copystring( StringOutputStream( 256 )( PathFilenameless( path ), fileinfo.name ) );
|
||||||
ex_argv[ex_argc++] = copystring( filename );
|
|
||||||
} while ( _findnext( handle, &fileinfo ) != -1 );
|
} while ( _findnext( handle, &fileinfo ) != -1 );
|
||||||
|
|
||||||
_findclose( handle );
|
_findclose( handle );
|
||||||
|
|
|
||||||
|
|
@ -85,21 +85,3 @@ inline void FixDOSName( char *src ){
|
||||||
if ( *src == '\\' )
|
if ( *src == '\\' )
|
||||||
*src = '/';
|
*src = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
// file directory with trailing slash
|
|
||||||
// NOTE: includes the slash, otherwise
|
|
||||||
// backing to an empty path will be wrong when appending a slash
|
|
||||||
inline void ExtractFilePath( const char *path, char *dest ){
|
|
||||||
strcpyQ( dest, path, path_get_filename_start( path ) - path + 1 ); // +1 for '\0'
|
|
||||||
}
|
|
||||||
|
|
||||||
// file name w/o extension
|
|
||||||
inline void ExtractFileBase( const char *path, char *dest ){
|
|
||||||
const char* start = path_get_filename_start( path );
|
|
||||||
const char* end = path_get_filename_base_end( start );
|
|
||||||
strcpyQ( dest, start, end - start + 1 ); // +1 for '\0'
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void ExtractFileExtension( const char *path, char *dest ){
|
|
||||||
strcpy( dest, path_get_extension( path ) );
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -448,9 +448,6 @@ void MergeRelativePath( char *out, const char *absolute, const char *relative ){
|
||||||
|
|
||||||
int MiniMapBSPMain( Args& args ){
|
int MiniMapBSPMain( Args& args ){
|
||||||
char minimapFilename[1024];
|
char minimapFilename[1024];
|
||||||
char basename[1024];
|
|
||||||
char path[1024];
|
|
||||||
char relativeMinimapFilename[1024];
|
|
||||||
bool autolevel;
|
bool autolevel;
|
||||||
float minimapSharpen;
|
float minimapSharpen;
|
||||||
float border;
|
float border;
|
||||||
|
|
@ -578,14 +575,14 @@ int MiniMapBSPMain( Args& args ){
|
||||||
MiniMapMakeMinsMaxs( mins, maxs, border, keepaspect );
|
MiniMapMakeMinsMaxs( mins, maxs, border, keepaspect );
|
||||||
|
|
||||||
if ( strEmpty( minimapFilename ) ) {
|
if ( strEmpty( minimapFilename ) ) {
|
||||||
ExtractFileBase( source, basename );
|
const CopiedString basename( PathFilename( source ) );
|
||||||
ExtractFilePath( source, path );
|
const CopiedString path( PathFilenameless( source ) );
|
||||||
sprintf( relativeMinimapFilename, g_game->miniMapNameFormat, basename );
|
char relativeMinimapFilename[1024];
|
||||||
MergeRelativePath( minimapFilename, path, relativeMinimapFilename );
|
sprintf( relativeMinimapFilename, g_game->miniMapNameFormat, basename.c_str() );
|
||||||
|
MergeRelativePath( minimapFilename, path.c_str(), relativeMinimapFilename );
|
||||||
Sys_Printf( "Output file name automatically set to %s\n", minimapFilename );
|
Sys_Printf( "Output file name automatically set to %s\n", minimapFilename );
|
||||||
}
|
}
|
||||||
ExtractFilePath( minimapFilename, path );
|
Q_mkdir( CopiedString( PathFilenameless( minimapFilename ) ).c_str() );
|
||||||
Q_mkdir( path );
|
|
||||||
|
|
||||||
if ( minimapSharpen >= 0 ) {
|
if ( minimapSharpen >= 0 ) {
|
||||||
minimap.sharpen_centermult = 8 * minimapSharpen + 1;
|
minimap.sharpen_centermult = 8 * minimapSharpen + 1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user