mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
more preparations for VC++ building
This commit is contained in:
parent
a842722d15
commit
46821fc8f1
@ -1,7 +1,10 @@
|
|||||||
bin_PROGRAMS = ppremake
|
bin_PROGRAMS = ppremake
|
||||||
|
|
||||||
ppremake_SOURCES = \
|
ppremake_SOURCES = \
|
||||||
check_include.cxx check_include.h filename.cxx filename.h \
|
check_include.cxx check_include.h \
|
||||||
|
dSearchPath.I dSearchPath.cxx dSearchPath.h \
|
||||||
|
executionEnvironment.cxx executionEnvironment.h \
|
||||||
|
filename.I filename.cxx filename.h \
|
||||||
find_searchpath.cxx find_searchpath.h \
|
find_searchpath.cxx find_searchpath.h \
|
||||||
gnu_getopt.c gnu_getopt.h gnu_regex.c gnu_regex.h \
|
gnu_getopt.c gnu_getopt.h gnu_regex.c gnu_regex.h \
|
||||||
ppCommandFile.cxx ppCommandFile.h ppDependableFile.cxx \
|
ppCommandFile.cxx ppCommandFile.h ppDependableFile.cxx \
|
||||||
@ -14,4 +17,4 @@ ppremake_SOURCES = \
|
|||||||
ppremake.cxx ppremake.h sedAddress.cxx sedAddress.h sedCommand.cxx \
|
ppremake.cxx ppremake.h sedAddress.cxx sedAddress.h sedCommand.cxx \
|
||||||
sedCommand.h sedContext.cxx sedContext.h sedProcess.cxx \
|
sedCommand.h sedContext.cxx sedContext.h sedProcess.cxx \
|
||||||
sedProcess.h sedScript.cxx sedScript.h tokenize.cxx \
|
sedProcess.h sedScript.cxx sedScript.h tokenize.cxx \
|
||||||
tokenize.h
|
tokenize.h vector_string.h
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
/* Define if the C++ iostream library supports ios::binary. */
|
/* Define if the C++ iostream library supports ios::binary. */
|
||||||
#undef HAVE_IOS_BINARY
|
#undef HAVE_IOS_BINARY
|
||||||
|
|
||||||
/* Define if we're compiling for a Windows platform. */
|
/* Define if we're compiling for Cygwin. */
|
||||||
#undef PLATFORM_WIN32
|
#undef PLATFORM_CYGWIN
|
||||||
|
|
||||||
/* Define if we're compiling using Windows Microsoft Visual C++. */
|
/* Define if we're compiling using Windows Microsoft Visual C++. */
|
||||||
#undef WIN32_VC
|
#undef WIN32_VC
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
/* Define if the C++ iostream library supports ios::binary. */
|
/* Define if the C++ iostream library supports ios::binary. */
|
||||||
/* #undef HAVE_IOS_BINARY */
|
/* #undef HAVE_IOS_BINARY */
|
||||||
|
|
||||||
/* Define if we're compiling for a Windows platform. */
|
/* Define if we're compiling for Cygwin. */
|
||||||
#define PLATFORM_WIN32 1
|
/* #undef PLATFORM_CYGWIN */
|
||||||
|
|
||||||
/* Define if we're compiling using Windows Microsoft Visual C++. */
|
/* Define if we're compiling using Windows Microsoft Visual C++. */
|
||||||
#define WIN32_VC 1
|
#define WIN32_VC 1
|
||||||
@ -79,5 +79,9 @@
|
|||||||
/* Define if you have the ANSI C header files. */
|
/* Define if you have the ANSI C header files. */
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
/* Version number of package */
|
/**************** UPDATE VERSION NUMBER HERE ****************
|
||||||
#define VERSION "1.03"
|
** Also be sure to change the version number **
|
||||||
|
** at the beginning of configure.in. **
|
||||||
|
**************** ****************/
|
||||||
|
#define VERSION "1.04"
|
||||||
|
/**************** UPDATE VERSION NUMBER HERE ****************/
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT(ppremake.cxx)
|
AC_INIT(ppremake.cxx)
|
||||||
AM_INIT_AUTOMAKE(ppremake, 1.03)
|
|
||||||
|
dnl **************** UPDATE VERSION NUMBER HERE ****************
|
||||||
|
dnl ** Also be sure to change the version number **
|
||||||
|
dnl ** at the end of config_msvc.h. **
|
||||||
|
dnl **************** ****************
|
||||||
|
AM_INIT_AUTOMAKE(ppremake, 1.04)
|
||||||
|
dnl **************** UPDATE VERSION NUMBER HERE ****************
|
||||||
|
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
AC_PREFIX_DEFAULT(/usr/local/panda)
|
AC_PREFIX_DEFAULT(/usr/local/panda)
|
||||||
@ -60,14 +67,14 @@ else
|
|||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
irix*) PLATFORM=Irix;;
|
irix*) PLATFORM=Irix;;
|
||||||
linux*) PLATFORM=Linux;;
|
linux*) PLATFORM=Linux;;
|
||||||
cygwin*) PLATFORM=Win32;;
|
cygwin*) PLATFORM=Cygwin;;
|
||||||
*) echo "Cannot determine platform; use --with-platform=name."
|
*) echo "Cannot determine platform; use --with-platform=name."
|
||||||
exit 1;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$PLATFORM" = "Win32"; then
|
if test "$PLATFORM" = "Cygwin"; then
|
||||||
AC_DEFINE(PLATFORM_WIN32)
|
AC_DEFINE(PLATFORM_CYGWIN)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM")
|
AC_DEFINE_UNQUOTED(PLATFORM, "$PLATFORM")
|
||||||
|
34
ppremake/dSearchPath.I
Normal file
34
ppremake/dSearchPath.I
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Filename: dSearchPath.I
|
||||||
|
// Created by: drose (01Jul00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::search_path
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: A quick-and-easy way to search a searchpath for a
|
||||||
|
// file when you don't feel like building or keeping
|
||||||
|
// around a DSearchPath object. This simply
|
||||||
|
// constructs a temporary DSearchPath based on the
|
||||||
|
// indicated path string, and searches that.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename DSearchPath::
|
||||||
|
search_path(const Filename &filename, const string &path,
|
||||||
|
const string &delimiters) {
|
||||||
|
DSearchPath search(path, delimiters);
|
||||||
|
return search.find_file(filename);
|
||||||
|
}
|
334
ppremake/dSearchPath.cxx
Normal file
334
ppremake/dSearchPath.cxx
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
// Filename: dSearchPath.cxx
|
||||||
|
// Created by: drose (01Jul00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "dSearchPath.h"
|
||||||
|
#include "filename.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::Results::
|
||||||
|
Results() {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::Results::
|
||||||
|
Results(const DSearchPath::Results ©) :
|
||||||
|
_files(copy._files)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::Copy Assignment Operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::Results::
|
||||||
|
operator = (const DSearchPath::Results ©) {
|
||||||
|
_files = copy._files;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::Destructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::Results::
|
||||||
|
~Results() {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::clear
|
||||||
|
// Access: Public
|
||||||
|
// Description: Removes all the files from the list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::Results::
|
||||||
|
clear() {
|
||||||
|
_files.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::get_num_files
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the number of files on the result list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int DSearchPath::Results::
|
||||||
|
get_num_files() const {
|
||||||
|
return _files.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Results::get_file
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the nth file on the result list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Filename DSearchPath::Results::
|
||||||
|
get_file(int n) const {
|
||||||
|
assert(n >= 0 && n < (int)_files.size());
|
||||||
|
return _files[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Default Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description: Creates an empty search path.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::
|
||||||
|
DSearchPath() {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::
|
||||||
|
DSearchPath(const string &path, const string &delimiters) {
|
||||||
|
append_path(path, delimiters);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::
|
||||||
|
DSearchPath(const DSearchPath ©) :
|
||||||
|
_directories(copy._directories)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Copy Assignment Operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
operator = (const DSearchPath ©) {
|
||||||
|
_directories = copy._directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::Destructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
DSearchPath::
|
||||||
|
~DSearchPath() {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::clear
|
||||||
|
// Access: Public
|
||||||
|
// Description: Removes all the directories from the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
clear() {
|
||||||
|
_directories.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::append_directory
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds a new directory to the end of the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
append_directory(const Filename &directory) {
|
||||||
|
_directories.push_back(directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::prepend_directory
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds a new directory to the front of the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
prepend_directory(const Filename &directory) {
|
||||||
|
_directories.insert(_directories.begin(), directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::append_path
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds all of the directories listed in the search path
|
||||||
|
// to the end of the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
append_path(const string &path, const string &delimiters) {
|
||||||
|
size_t p = 0;
|
||||||
|
while (p < path.length()) {
|
||||||
|
size_t q = path.find_first_of(delimiters, p);
|
||||||
|
if (q == string::npos) {
|
||||||
|
_directories.push_back(path.substr(p));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (q != p) {
|
||||||
|
_directories.push_back(path.substr(p, q - p));
|
||||||
|
}
|
||||||
|
p = q + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::append_path
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds all of the directories listed in the search path
|
||||||
|
// to the end of the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
append_path(const DSearchPath &path) {
|
||||||
|
copy(path._directories.begin(), path._directories.end(),
|
||||||
|
back_inserter(_directories));
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::prepend_path
|
||||||
|
// Access: Public
|
||||||
|
// Description: Adds all of the directories listed in the search path
|
||||||
|
// to the beginning of the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
prepend_path(const DSearchPath &path) {
|
||||||
|
if (!path._directories.empty()) {
|
||||||
|
Directories new_directories = path._directories;
|
||||||
|
copy(_directories.begin(), _directories.end(),
|
||||||
|
back_inserter(new_directories));
|
||||||
|
_directories.swap(new_directories);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::is_empty
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the search list is empty, false
|
||||||
|
// otherwise.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DSearchPath::
|
||||||
|
is_empty() const {
|
||||||
|
return _directories.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::get_num_directories
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the number of directories on the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int DSearchPath::
|
||||||
|
get_num_directories() const {
|
||||||
|
return _directories.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::get_directory
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the nth directory on the search list.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Filename DSearchPath::
|
||||||
|
get_directory(int n) const {
|
||||||
|
assert(n >= 0 && n < (int)_directories.size());
|
||||||
|
return _directories[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::find_file
|
||||||
|
// Access: Public
|
||||||
|
// Description: Searches all the directories in the search list for
|
||||||
|
// the indicated file, in order. Returns the full
|
||||||
|
// matching pathname of the first match if found, or the
|
||||||
|
// empty string if not found.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Filename DSearchPath::
|
||||||
|
find_file(const Filename &filename) const {
|
||||||
|
Directories::const_iterator di;
|
||||||
|
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||||
|
Filename match((*di), filename);
|
||||||
|
if (match.exists()) {
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::find_all_files
|
||||||
|
// Access: Public
|
||||||
|
// Description: Searches all the directories in the search list for
|
||||||
|
// the indicated file, in order. Fills up the results
|
||||||
|
// list with *all* of the matching filenames found, if
|
||||||
|
// any. Returns the number of matches found.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
int DSearchPath::
|
||||||
|
find_all_files(const Filename &filename,
|
||||||
|
DSearchPath::Results &results) const {
|
||||||
|
results._files.clear();
|
||||||
|
|
||||||
|
Directories::const_iterator di;
|
||||||
|
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||||
|
Filename match((*di), filename);
|
||||||
|
if (match.exists()) {
|
||||||
|
results._files.push_back(match);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results._files.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::output
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
output(ostream &out, const string &separator) const {
|
||||||
|
if (!_directories.empty()) {
|
||||||
|
Directories::const_iterator di = _directories.begin();
|
||||||
|
out << (*di);
|
||||||
|
++di;
|
||||||
|
while (di != _directories.end()) {
|
||||||
|
out << separator << (*di);
|
||||||
|
++di;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DSearchPath::write
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DSearchPath::
|
||||||
|
write(ostream &out, int indent_level) const {
|
||||||
|
Directories::const_iterator di;
|
||||||
|
for (di = _directories.begin(); di != _directories.end(); ++di) {
|
||||||
|
for (int i = 0; i < indent_level; i++) {
|
||||||
|
out << ' ';
|
||||||
|
}
|
||||||
|
out << (*di) << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
97
ppremake/dSearchPath.h
Normal file
97
ppremake/dSearchPath.h
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
// Filename: dSearchPath.h
|
||||||
|
// Created by: drose (01Jul00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef PANDASEARCHPATH_H
|
||||||
|
#define PANDASEARCHPATH_H
|
||||||
|
|
||||||
|
#include "ppremake.h"
|
||||||
|
|
||||||
|
#include "filename.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
// Class : DSearchPath
|
||||||
|
// Description : This class stores a list of directories that can be
|
||||||
|
// searched, in order, to locate a particular file. It
|
||||||
|
// is normally constructed by passing it a traditional
|
||||||
|
// searchpath-style string, e.g. a list of directory
|
||||||
|
// names delimited by spaces or colons, but it can also
|
||||||
|
// be built up explicitly.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_DTOOL DSearchPath {
|
||||||
|
public:
|
||||||
|
class EXPCL_DTOOL Results {
|
||||||
|
PUBLISHED:
|
||||||
|
Results();
|
||||||
|
Results(const Results ©);
|
||||||
|
void operator = (const Results ©);
|
||||||
|
~Results();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
int get_num_files() const;
|
||||||
|
Filename get_file(int n) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef vector<Filename> Files;
|
||||||
|
Files _files;
|
||||||
|
friend class DSearchPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
|
DSearchPath();
|
||||||
|
DSearchPath(const string &path, const string &delimiters = ": \n\t");
|
||||||
|
DSearchPath(const DSearchPath ©);
|
||||||
|
void operator = (const DSearchPath ©);
|
||||||
|
~DSearchPath();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void append_directory(const Filename &directory);
|
||||||
|
void prepend_directory(const Filename &directory);
|
||||||
|
void append_path(const string &path,
|
||||||
|
const string &delimiters = ": \n\t");
|
||||||
|
void append_path(const DSearchPath &path);
|
||||||
|
void prepend_path(const DSearchPath &path);
|
||||||
|
|
||||||
|
bool is_empty() const;
|
||||||
|
int get_num_directories() const;
|
||||||
|
Filename get_directory(int n) const;
|
||||||
|
|
||||||
|
Filename find_file(const Filename &filename) const;
|
||||||
|
int find_all_files(const Filename &filename, Results &results) const;
|
||||||
|
|
||||||
|
INLINE static Filename
|
||||||
|
search_path(const Filename &filename, const string &path,
|
||||||
|
const string &delimiters = ": \n\t");
|
||||||
|
|
||||||
|
void output(ostream &out, const string &separator = ":") const;
|
||||||
|
void write(ostream &out, int indent_level = 0) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef vector<Filename> Directories;
|
||||||
|
Directories _directories;
|
||||||
|
};
|
||||||
|
|
||||||
|
INLINE ostream &operator << (ostream &out, const DSearchPath &sp) {
|
||||||
|
sp.output(out);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "dSearchPath.I"
|
||||||
|
|
||||||
|
#endif
|
62
ppremake/executionEnvironment.cxx
Normal file
62
ppremake/executionEnvironment.cxx
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Filename: executionEnvironment.cxx
|
||||||
|
// Created by: drose (15May00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "executionEnvironment.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdio.h> // for perror
|
||||||
|
|
||||||
|
#ifdef WIN32_VC
|
||||||
|
// Windows requires this for getcwd().
|
||||||
|
#include <direct.h>
|
||||||
|
#define getcwd _getcwd
|
||||||
|
#endif
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: ExecutionEnviroment::get_cwd
|
||||||
|
// Access: Public, Static
|
||||||
|
// Description: Returns the name of the current working directory.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
Filename ExecutionEnvironment::
|
||||||
|
get_cwd() {
|
||||||
|
// getcwd() requires us to allocate a dynamic buffer and grow it on
|
||||||
|
// demand.
|
||||||
|
static size_t bufsize = 1024;
|
||||||
|
static char *buffer = NULL;
|
||||||
|
|
||||||
|
if (buffer == (char *)NULL) {
|
||||||
|
buffer = new char[bufsize];
|
||||||
|
}
|
||||||
|
|
||||||
|
while (getcwd(buffer, bufsize) == (char *)NULL) {
|
||||||
|
if (errno != ERANGE) {
|
||||||
|
perror("getcwd");
|
||||||
|
return string();
|
||||||
|
}
|
||||||
|
delete[] buffer;
|
||||||
|
bufsize = bufsize * 2;
|
||||||
|
buffer = new char[bufsize];
|
||||||
|
assert(buffer != (char *)NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Filename::from_os_specific(buffer);
|
||||||
|
}
|
36
ppremake/executionEnvironment.h
Normal file
36
ppremake/executionEnvironment.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Filename: executionEnvironment.h
|
||||||
|
// Created by: drose (15May00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef EXECUTIONENVIRONMENT_H
|
||||||
|
#define EXECUTIONENVIRONMENT_H
|
||||||
|
|
||||||
|
#include "ppremake.h"
|
||||||
|
#include "filename.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : ExecutionEnvironment
|
||||||
|
// Description : This class is borrowed from dtool/src/dtoolutil, and
|
||||||
|
// stripped down to just the bare minimum that Filename
|
||||||
|
// needs; and also modified to build outside of Panda.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class ExecutionEnvironment {
|
||||||
|
public:
|
||||||
|
static Filename get_cwd();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
452
ppremake/filename.I
Normal file
452
ppremake/filename.I
Normal file
@ -0,0 +1,452 @@
|
|||||||
|
// Filename: filename.I
|
||||||
|
// Created by: drose (18Jan99)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::
|
||||||
|
Filename(const string &filename) {
|
||||||
|
(*this) = filename;
|
||||||
|
_flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::
|
||||||
|
Filename(const char *filename) {
|
||||||
|
(*this) = filename;
|
||||||
|
_flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Copy Constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::
|
||||||
|
Filename(const Filename ©)
|
||||||
|
: _filename(copy._filename),
|
||||||
|
_dirname_end(copy._dirname_end),
|
||||||
|
_basename_start(copy._basename_start),
|
||||||
|
_basename_end(copy._basename_end),
|
||||||
|
_extension_start(copy._extension_start),
|
||||||
|
_flags(copy._flags)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::text_filename named constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename Filename::
|
||||||
|
text_filename(const string &filename) {
|
||||||
|
Filename result(filename);
|
||||||
|
result.set_text();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::binary_filename named constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename Filename::
|
||||||
|
binary_filename(const string &filename) {
|
||||||
|
Filename result(filename);
|
||||||
|
result.set_binary();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::dso_filename named constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename Filename::
|
||||||
|
dso_filename(const string &filename) {
|
||||||
|
Filename result(filename);
|
||||||
|
result.set_type(T_dso);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::executable_filename named constructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename Filename::
|
||||||
|
executable_filename(const string &filename) {
|
||||||
|
Filename result(filename);
|
||||||
|
result.set_type(T_executable);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Destructor
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::
|
||||||
|
~Filename() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Assignment operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename &Filename::
|
||||||
|
operator = (const string &filename) {
|
||||||
|
_filename = filename;
|
||||||
|
|
||||||
|
locate_basename();
|
||||||
|
locate_extension();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Assignment operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename &Filename::
|
||||||
|
operator = (const char *filename) {
|
||||||
|
assert(filename != NULL);
|
||||||
|
return (*this) = string(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Copy assignment operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename &Filename::
|
||||||
|
operator = (const Filename ©) {
|
||||||
|
_filename = copy._filename;
|
||||||
|
_dirname_end = copy._dirname_end;
|
||||||
|
_basename_start = copy._basename_start;
|
||||||
|
_basename_end = copy._basename_end;
|
||||||
|
_extension_start = copy._extension_start;
|
||||||
|
_flags = copy._flags;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::string typecast operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::
|
||||||
|
operator const string & () const {
|
||||||
|
return _filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::c_str
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE const char *Filename::
|
||||||
|
c_str() const {
|
||||||
|
return _filename.c_str();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::empty
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
empty() const {
|
||||||
|
return _filename.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::length
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE size_t Filename::
|
||||||
|
length() const {
|
||||||
|
return _filename.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Indexing operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE char Filename::
|
||||||
|
operator [] (int n) const {
|
||||||
|
assert(n >= 0 && n < (int)_filename.length());
|
||||||
|
return _filename[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_fullpath
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the entire filename: directory, basename,
|
||||||
|
// extension. This is the same thing returned by the
|
||||||
|
// string typecast operator, so this function is a
|
||||||
|
// little redundant.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_fullpath() const {
|
||||||
|
return _filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_dirname
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the directory part of the filename. This is
|
||||||
|
// everything in the filename up to, but not including
|
||||||
|
// the rightmost slash.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_dirname() const {
|
||||||
|
return _filename.substr(0, _dirname_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_basename
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the basename part of the filename. This is
|
||||||
|
// everything in the filename after the rightmost slash,
|
||||||
|
// including any extensions.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_basename() const {
|
||||||
|
return _filename.substr(_basename_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_fullpath_wo_extension
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the full filename--directory and basename
|
||||||
|
// parts--except for the extension.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_fullpath_wo_extension() const {
|
||||||
|
return _filename.substr(0, _basename_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_basename_wo_extension
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the basename part of the filename, without
|
||||||
|
// the file extension.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_basename_wo_extension() const {
|
||||||
|
if (_basename_end == string::npos) {
|
||||||
|
return _filename.substr(_basename_start);
|
||||||
|
} else {
|
||||||
|
return _filename.substr(_basename_start, _basename_end - _basename_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_extension
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the file extension. This is everything after
|
||||||
|
// the rightmost dot, if there is one, or the empty
|
||||||
|
// string if there is not.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE string Filename::
|
||||||
|
get_extension() const {
|
||||||
|
if (_extension_start == string::npos) {
|
||||||
|
return string();
|
||||||
|
} else {
|
||||||
|
return _filename.substr(_extension_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::set_binary
|
||||||
|
// Access: Public
|
||||||
|
// Description: Indicates that the filename represents a binary file.
|
||||||
|
// This is primarily relevant to the read_file() and
|
||||||
|
// write_file() methods, so they can set the appropriate
|
||||||
|
// flags to the OS.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void Filename::
|
||||||
|
set_binary() {
|
||||||
|
_flags = (_flags & ~F_text) | F_binary;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::set_text
|
||||||
|
// Access: Public
|
||||||
|
// Description: Indicates that the filename represents a text file.
|
||||||
|
// This is primarily relevant to the read_file() and
|
||||||
|
// write_file() methods, so they can set the appropriate
|
||||||
|
// flags to the OS.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void Filename::
|
||||||
|
set_text() {
|
||||||
|
_flags = (_flags & ~F_binary) | F_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::is_binary
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the Filename has been indicated to
|
||||||
|
// represent a binary file via a previous call to
|
||||||
|
// set_binary(). It is possible that neither
|
||||||
|
// is_binary() nor is_text() will be true, if neither
|
||||||
|
// set_binary() nor set_text() was ever called.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
is_binary() const {
|
||||||
|
return ((_flags & F_binary) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::is_text
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the Filename has been indicated to
|
||||||
|
// represent a text file via a previous call to
|
||||||
|
// set_text(). It is possible that neither is_binary()
|
||||||
|
// nor is_text() will be true, if neither set_binary()
|
||||||
|
// nor set_text() was ever called.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
is_text() const {
|
||||||
|
return ((_flags & F_text) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::set_type
|
||||||
|
// Access: Public
|
||||||
|
// Description: Sets the type of the file represented by the
|
||||||
|
// filename. This is useful for to_os_specific(),
|
||||||
|
// resolve_filename(), test_existence(), and all such
|
||||||
|
// real-world access functions. It helps the Filename
|
||||||
|
// know how to map the internal filename to the
|
||||||
|
// OS-specific filename (for instance, maybe executables
|
||||||
|
// should have an .exe extension).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void Filename::
|
||||||
|
set_type(Filename::Type type) {
|
||||||
|
_flags = (_flags & ~F_type) | type;
|
||||||
|
switch (type) {
|
||||||
|
case T_dso:
|
||||||
|
case T_executable:
|
||||||
|
set_binary();
|
||||||
|
|
||||||
|
case T_general:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::get_type
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns the type of the file represented by the
|
||||||
|
// filename, as previously set by set_type().
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE Filename::Type Filename::
|
||||||
|
get_type() const {
|
||||||
|
return (Type)(_flags & (int)F_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::is_local
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the filename is local, e.g. does not
|
||||||
|
// begin with a slash, or false if the filename is fully
|
||||||
|
// specified from the root.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
is_local() const {
|
||||||
|
return _filename.empty() || _filename[0] != '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::is_fully_qualified
|
||||||
|
// Access: Public
|
||||||
|
// Description: Returns true if the filename is fully qualified,
|
||||||
|
// e.g. begins with a slash. This is almost, but not
|
||||||
|
// quite, the same thing as !is_local(). It's not
|
||||||
|
// exactly the same because a special case is made for
|
||||||
|
// filenames that begin with a single dot followed by a
|
||||||
|
// slash--these are considered to be fully qualified
|
||||||
|
// (they are explicitly relative to the current
|
||||||
|
// directory, and do not refer to a filename on a search
|
||||||
|
// path somewhere).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
is_fully_qualified() const {
|
||||||
|
return
|
||||||
|
(_filename.size() > 2 && _filename[0] == '.' && _filename[1] == '/') ||
|
||||||
|
(!_filename.empty() && _filename[0] == '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Equality operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
operator == (const string &other) const {
|
||||||
|
return (*(string *)this) == other;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Inequality operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
operator != (const string &other) const {
|
||||||
|
return (*(string *)this) != other;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::Ordering operator
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE bool Filename::
|
||||||
|
operator < (const string &other) const {
|
||||||
|
return (*(string *)this) < other;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::output
|
||||||
|
// Access: Public
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void Filename::
|
||||||
|
output(ostream &out) const {
|
||||||
|
out << _filename;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,18 @@
|
|||||||
// Filename: filename.h
|
// Filename: filename.h
|
||||||
// Created by: drose (19Oct00)
|
// Created by: drose (18Jan99)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -8,12 +21,176 @@
|
|||||||
|
|
||||||
#include "ppremake.h"
|
#include "ppremake.h"
|
||||||
|
|
||||||
// This header file defines a few functions handy for dealing with
|
#include "vector_string.h"
|
||||||
// filenames in a cross-platform world.
|
|
||||||
|
|
||||||
bool is_fullpath(const string &pathname);
|
#include <assert.h>
|
||||||
string to_os_filename(string pathname);
|
|
||||||
string to_unix_filename(string pathname);
|
class DSearchPath;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : Filename
|
||||||
|
// Description : The name of a file, such as a texture file or an Egg
|
||||||
|
// file. Stores the full pathname, and includes
|
||||||
|
// functions for extracting out the directory prefix
|
||||||
|
// part and the file extension and stuff.
|
||||||
|
//
|
||||||
|
// A Filename is also aware of the mapping between the
|
||||||
|
// Unix-like filename convention we use internally, and
|
||||||
|
// the local OS's specific filename convention, and it
|
||||||
|
// knows how to perform basic OS-specific I/O, like
|
||||||
|
// testing for file existence and searching a
|
||||||
|
// searchpath, as well as the best way to open an
|
||||||
|
// fstream for reading or writing.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
class EXPCL_DTOOL Filename {
|
||||||
|
PUBLISHED:
|
||||||
|
enum Type {
|
||||||
|
// These type values must fit within the bits allocated for
|
||||||
|
// F_type, below.
|
||||||
|
T_general = 0x00,
|
||||||
|
T_dso = 0x01,
|
||||||
|
T_executable = 0x02,
|
||||||
|
// Perhaps other types will be added later.
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum Flags {
|
||||||
|
F_type = 0x0f,
|
||||||
|
F_binary = 0x10,
|
||||||
|
F_text = 0x20,
|
||||||
|
};
|
||||||
|
|
||||||
|
PUBLISHED:
|
||||||
|
INLINE Filename(const string &filename = "");
|
||||||
|
INLINE Filename(const char *filename);
|
||||||
|
INLINE Filename(const Filename ©);
|
||||||
|
Filename(const Filename &dirname, const Filename &basename);
|
||||||
|
INLINE ~Filename();
|
||||||
|
|
||||||
|
// Static constructors to explicitly create a filename that refers
|
||||||
|
// to a text or binary file. This is in lieu of calling set_text()
|
||||||
|
// or set_binary() or set_type().
|
||||||
|
INLINE static Filename text_filename(const string &filename);
|
||||||
|
INLINE static Filename binary_filename(const string &filename);
|
||||||
|
INLINE static Filename dso_filename(const string &filename);
|
||||||
|
INLINE static Filename executable_filename(const string &filename);
|
||||||
|
|
||||||
|
static Filename from_os_specific(const string &os_specific,
|
||||||
|
Type type = T_general);
|
||||||
|
static Filename temporary(const string &dirname, const string &prefix,
|
||||||
|
Type type = T_general);
|
||||||
|
|
||||||
|
// Assignment is via the = operator.
|
||||||
|
INLINE Filename &operator = (const string &filename);
|
||||||
|
INLINE Filename &operator = (const char *filename);
|
||||||
|
INLINE Filename &operator = (const Filename ©);
|
||||||
|
|
||||||
|
// And retrieval is by any of the classic string operations.
|
||||||
|
INLINE operator const string & () const;
|
||||||
|
INLINE const char *c_str() const;
|
||||||
|
INLINE bool empty() const;
|
||||||
|
INLINE size_t length() const;
|
||||||
|
INLINE char operator [] (int n) const;
|
||||||
|
|
||||||
|
// Or, you can use any of these.
|
||||||
|
INLINE string get_fullpath() const;
|
||||||
|
INLINE string get_dirname() const;
|
||||||
|
INLINE string get_basename() const;
|
||||||
|
INLINE string get_fullpath_wo_extension() const;
|
||||||
|
INLINE string get_basename_wo_extension() const;
|
||||||
|
INLINE string get_extension() const;
|
||||||
|
|
||||||
|
// You can also use any of these to reassign pieces of the filename.
|
||||||
|
void set_fullpath(const string &s);
|
||||||
|
void set_dirname(const string &s);
|
||||||
|
void set_basename(const string &s);
|
||||||
|
void set_fullpath_wo_extension(const string &s);
|
||||||
|
void set_basename_wo_extension(const string &s);
|
||||||
|
void set_extension(const string &s);
|
||||||
|
|
||||||
|
// Setting these flags appropriately is helpful when opening or
|
||||||
|
// searching for a file; it helps the Filename resolve OS-specific
|
||||||
|
// conventions (for instance, that dynamic library names should
|
||||||
|
// perhaps be changed from .so to .dll).
|
||||||
|
INLINE void set_binary();
|
||||||
|
INLINE void set_text();
|
||||||
|
INLINE bool is_binary() const;
|
||||||
|
INLINE bool is_text() const;
|
||||||
|
|
||||||
|
INLINE void set_type(Type type);
|
||||||
|
INLINE Type get_type() const;
|
||||||
|
|
||||||
|
void standardize();
|
||||||
|
|
||||||
|
// The following functions deal with the outside world.
|
||||||
|
|
||||||
|
INLINE bool is_local() const;
|
||||||
|
INLINE bool is_fully_qualified() const;
|
||||||
|
void make_absolute();
|
||||||
|
void make_absolute(const Filename &start_directory);
|
||||||
|
|
||||||
|
bool make_canonical();
|
||||||
|
|
||||||
|
string to_os_specific() const;
|
||||||
|
|
||||||
|
bool exists() const;
|
||||||
|
bool is_regular_file() const;
|
||||||
|
bool is_directory() const;
|
||||||
|
bool is_executable() const;
|
||||||
|
int compare_timestamps(const Filename &other,
|
||||||
|
bool this_missing_is_old = true,
|
||||||
|
bool other_missing_is_old = true) const;
|
||||||
|
bool resolve_filename(const DSearchPath &searchpath,
|
||||||
|
const string &default_extension = string());
|
||||||
|
bool make_relative_to(Filename directory, bool allow_backups = true);
|
||||||
|
int find_on_searchpath(const DSearchPath &searchpath);
|
||||||
|
|
||||||
|
bool scan_directory(vector_string &contents) const;
|
||||||
|
|
||||||
|
bool open_read(ifstream &stream) const;
|
||||||
|
bool open_write(ofstream &stream) const;
|
||||||
|
bool open_append(ofstream &stream) const;
|
||||||
|
bool open_read_write(fstream &stream) const;
|
||||||
|
|
||||||
|
bool touch() const;
|
||||||
|
|
||||||
|
bool unlink() const;
|
||||||
|
bool rename_to(const Filename &other) const;
|
||||||
|
|
||||||
|
bool make_dir() const;
|
||||||
|
|
||||||
|
// Comparison operators are handy.
|
||||||
|
INLINE bool operator == (const string &other) const;
|
||||||
|
INLINE bool operator != (const string &other) const;
|
||||||
|
INLINE bool operator < (const string &other) const;
|
||||||
|
|
||||||
|
INLINE void output(ostream &out) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void locate_basename();
|
||||||
|
void locate_extension();
|
||||||
|
size_t get_common_prefix(const string &other) const;
|
||||||
|
static int count_slashes(const string &str);
|
||||||
|
|
||||||
|
string _filename;
|
||||||
|
// We'll make these size_t instead of string::size_type to help out
|
||||||
|
// cppParser.
|
||||||
|
size_t _dirname_end;
|
||||||
|
size_t _basename_start;
|
||||||
|
size_t _basename_end;
|
||||||
|
size_t _extension_start;
|
||||||
|
|
||||||
|
int _flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
INLINE ostream &operator << (ostream &out, const Filename &n) {
|
||||||
|
n.output(out);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "filename.I"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1145,10 +1145,10 @@ expand_variable_nested(const string &varname,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string PPScope::
|
string PPScope::
|
||||||
expand_isfullpath(const string ¶ms) {
|
expand_isfullpath(const string ¶ms) {
|
||||||
string filename = trim_blanks(expand_string(params));
|
Filename filename = trim_blanks(expand_string(params));
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
if (is_fullpath(filename)) {
|
if (filename.is_fully_qualified()) {
|
||||||
result = filename;
|
result = filename;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -1160,15 +1160,12 @@ expand_isfullpath(const string ¶ms) {
|
|||||||
// Description: Expands the "osfilename" function variable. This
|
// Description: Expands the "osfilename" function variable. This
|
||||||
// converts the filename from a Unix-style filename
|
// converts the filename from a Unix-style filename
|
||||||
// (e.g. with slash separators) to a platform-specific
|
// (e.g. with slash separators) to a platform-specific
|
||||||
// filename. Currently, this only has an effect when
|
// filename.
|
||||||
// generating code for a Windows platform: it simply
|
|
||||||
// converts forward slashes to backslashes. On other
|
|
||||||
// platforms it has no effect.
|
|
||||||
//
|
//
|
||||||
// This is different from cygpath_w in that (a) it works
|
// This follows the same rules of Panda filename
|
||||||
// regardless of whether we are actually running under
|
// conversion; i.e. forward slashes become backslashes,
|
||||||
// Cygwin, and (b) it does nothing more intelligent than
|
// and $PANDA_ROOT prefixes full pathnames, unless the
|
||||||
// reverse slashes.
|
// topmost directory name is a single letter.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string PPScope::
|
string PPScope::
|
||||||
expand_osfilename(const string ¶ms) {
|
expand_osfilename(const string ¶ms) {
|
||||||
@ -1178,7 +1175,8 @@ expand_osfilename(const string ¶ms) {
|
|||||||
|
|
||||||
vector<string>::iterator wi;
|
vector<string>::iterator wi;
|
||||||
for (wi = words.begin(); wi != words.end(); ++wi) {
|
for (wi = words.begin(); wi != words.end(); ++wi) {
|
||||||
(*wi) = to_os_filename(*wi);
|
Filename filename = (*wi);
|
||||||
|
(*wi) = filename.to_os_specific();
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = repaste(words, " ");
|
string result = repaste(words, " ");
|
||||||
@ -1191,15 +1189,9 @@ expand_osfilename(const string ¶ms) {
|
|||||||
// Description: Expands the "unixfilename" function variable. This
|
// Description: Expands the "unixfilename" function variable. This
|
||||||
// converts the filename from a platform-specific
|
// converts the filename from a platform-specific
|
||||||
// filename to a Unix-style filename (e.g. with slash
|
// filename to a Unix-style filename (e.g. with slash
|
||||||
// separators). Currently, this only has an effect when
|
// separators).
|
||||||
// generating code for a Windows platform: it simply
|
|
||||||
// converts backslashes to forward slashes. On other
|
|
||||||
// platforms it has no effect.
|
|
||||||
//
|
//
|
||||||
// This is different from cygpath_p in that (a) it works
|
// This follows the rules of Panda filename conversion.
|
||||||
// regardless of whether we are actually running under
|
|
||||||
// Cygwin, and (b) it does nothing more intelligent than
|
|
||||||
// reverse slashes.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string PPScope::
|
string PPScope::
|
||||||
expand_unixfilename(const string ¶ms) {
|
expand_unixfilename(const string ¶ms) {
|
||||||
@ -1209,7 +1201,8 @@ expand_unixfilename(const string ¶ms) {
|
|||||||
|
|
||||||
vector<string>::iterator wi;
|
vector<string>::iterator wi;
|
||||||
for (wi = words.begin(); wi != words.end(); ++wi) {
|
for (wi = words.begin(); wi != words.end(); ++wi) {
|
||||||
(*wi) = to_unix_filename(*wi);
|
Filename filename = Filename::from_os_specific(*wi);
|
||||||
|
(*wi) = filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = repaste(words, " ");
|
string result = repaste(words, " ");
|
||||||
@ -1219,10 +1212,15 @@ expand_unixfilename(const string ¶ms) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: PPScope::expand_cygpath_w
|
// Function: PPScope::expand_cygpath_w
|
||||||
// Access: Private
|
// Access: Private
|
||||||
// Description: Expands the "cygpath_w" function variable. This is
|
// Description: Expands the "cygpath_w" function variable.
|
||||||
// equivalent to $[shell cygpath -w ...] when running
|
//
|
||||||
// under Cygwin, and returns the parameter itself when
|
// This converts the Unix-style filename to a Windows
|
||||||
// not running under Cygwin.
|
// filename using the Cygwin rules when ppremake has
|
||||||
|
// been compiled with Cygwin; it is thus equivalent to
|
||||||
|
// the result of the cygpath -w command.
|
||||||
|
//
|
||||||
|
// When ppremake has not been compiled with Cygwin, this
|
||||||
|
// returns the same as the "osfilename" variable.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string PPScope::
|
string PPScope::
|
||||||
expand_cygpath_w(const string ¶ms) {
|
expand_cygpath_w(const string ¶ms) {
|
||||||
@ -1233,6 +1231,9 @@ expand_cygpath_w(const string ¶ms) {
|
|||||||
|
|
||||||
cygwin_conv_to_win32_path(filename.c_str(), result);
|
cygwin_conv_to_win32_path(filename.c_str(), result);
|
||||||
filename = result;
|
filename = result;
|
||||||
|
#else
|
||||||
|
Filename fn(filename);
|
||||||
|
filename = fn.to_os_specific();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
@ -1241,10 +1242,15 @@ expand_cygpath_w(const string ¶ms) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: PPScope::expand_cygpath_p
|
// Function: PPScope::expand_cygpath_p
|
||||||
// Access: Private
|
// Access: Private
|
||||||
// Description: Expands the "cygpath_p" function variable. This is
|
// Description: Expands the "cygpath_p" function variable.
|
||||||
// equivalent to $[shell cygpath -p ...] when running
|
//
|
||||||
// under Cygwin, and returns the parameter itself when
|
// This converts the Windows filename to a Unix-style
|
||||||
// not running under Cygwin.
|
// filename using the Cygwin rules when ppremake has
|
||||||
|
// been compiled with Cygwin; it is thus equivalent to
|
||||||
|
// the result of the cygpath -p command.
|
||||||
|
//
|
||||||
|
// When ppremake has not been compiled with Cygwin, this
|
||||||
|
// returns the same as the "unixfilename" variable.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
string PPScope::
|
string PPScope::
|
||||||
expand_cygpath_p(const string ¶ms) {
|
expand_cygpath_p(const string ¶ms) {
|
||||||
@ -1255,6 +1261,8 @@ expand_cygpath_p(const string ¶ms) {
|
|||||||
|
|
||||||
cygwin_conv_to_posix_path(filename.c_str(), result);
|
cygwin_conv_to_posix_path(filename.c_str(), result);
|
||||||
filename = result;
|
filename = result;
|
||||||
|
#else
|
||||||
|
filename = Filename::from_os_specific(filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
@ -1389,7 +1397,7 @@ expand_libtest(const string ¶ms) {
|
|||||||
|
|
||||||
// Also add the system directories to the list, whatever we think
|
// Also add the system directories to the list, whatever we think
|
||||||
// those should be. Here we have to make a few assumptions.
|
// those should be. Here we have to make a few assumptions.
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef WIN32
|
||||||
const char *windir = getenv("WINDIR");
|
const char *windir = getenv("WINDIR");
|
||||||
if (windir != (const char *)NULL) {
|
if (windir != (const char *)NULL) {
|
||||||
directories.push_back(string(windir) + "\\System");
|
directories.push_back(string(windir) + "\\System");
|
||||||
@ -1427,7 +1435,7 @@ expand_libtest(const string ¶ms) {
|
|||||||
|
|
||||||
string found;
|
string found;
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef WIN32
|
||||||
if (libname.length() > 4 && libname.substr(libname.length() - 4) == ".lib") {
|
if (libname.length() > 4 && libname.substr(libname.length() - 4) == ".lib") {
|
||||||
found = find_searchpath(directories, libname);
|
found = find_searchpath(directories, libname);
|
||||||
if (found.empty()) {
|
if (found.empty()) {
|
||||||
@ -1472,7 +1480,7 @@ expand_bintest(const string ¶ms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// An explicit path from the root does not require a search.
|
// An explicit path from the root does not require a search.
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef WIN32
|
||||||
if ((binname.length() > 2 && binname[1] == ':') || binname[0] == '/')
|
if ((binname.length() > 2 && binname[1] == ':') || binname[0] == '/')
|
||||||
#else
|
#else
|
||||||
if (binname[0] == '/')
|
if (binname[0] == '/')
|
||||||
@ -1494,7 +1502,7 @@ expand_bintest(const string ¶ms) {
|
|||||||
|
|
||||||
vector<string> directories;
|
vector<string> directories;
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef WIN32
|
||||||
if (pathvar.find(';') != string::npos) {
|
if (pathvar.find(';') != string::npos) {
|
||||||
// If the path contains semicolons, it's a native Windows-style
|
// If the path contains semicolons, it's a native Windows-style
|
||||||
// path: split it up based on semicolons.
|
// path: split it up based on semicolons.
|
||||||
@ -1511,7 +1519,7 @@ expand_bintest(const string ¶ms) {
|
|||||||
|
|
||||||
string found;
|
string found;
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef WIN32
|
||||||
found = find_searchpath(directories, binname + ".exe");
|
found = find_searchpath(directories, binname + ".exe");
|
||||||
if (found.empty()) {
|
if (found.empty()) {
|
||||||
found = find_searchpath(directories, binname);
|
found = find_searchpath(directories, binname);
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
#include <strstream.h>
|
#include <strstream.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_CYGWIN) || defined(WIN32_VC)
|
||||||
|
// Either Cygwin or Visual C++ is a Win32 environment.
|
||||||
|
#define WIN32
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef HAVE_NAMESPACE
|
#ifdef HAVE_NAMESPACE
|
||||||
@ -67,4 +72,16 @@ extern bool unix_platform;
|
|||||||
extern bool windows_platform;
|
extern bool windows_platform;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* These are defined so that we may build Filename and DSearchPath,
|
||||||
|
which are copied from dtool. We have to copy these files from
|
||||||
|
dtool since ppremake must be built first, and stands outside of
|
||||||
|
Panda; but we want to minimize the changes we must make to these
|
||||||
|
files so that we can easily recopy them at need.
|
||||||
|
|
||||||
|
These symbols just make the build environment a bit more
|
||||||
|
Panda-like. */
|
||||||
|
#define PUBLISHED public
|
||||||
|
#define INLINE inline
|
||||||
|
#define EXPCL_DTOOL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
35
ppremake/vector_string.h
Normal file
35
ppremake/vector_string.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Filename: vector_string.h
|
||||||
|
// Created by: drose (15May00)
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// PANDA 3D SOFTWARE
|
||||||
|
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
|
||||||
|
//
|
||||||
|
// All use of this software is subject to the terms of the Panda 3d
|
||||||
|
// Software license. You should have received a copy of this license
|
||||||
|
// along with this source code; you will also find a current copy of
|
||||||
|
// the license at http://www.panda3d.org/license.txt .
|
||||||
|
//
|
||||||
|
// To contact the maintainers of this program write to
|
||||||
|
// panda3d@yahoogroups.com .
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef VECTOR_STRING_H
|
||||||
|
#define VECTOR_STRING_H
|
||||||
|
|
||||||
|
#include "ppremake.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Class : vector_string
|
||||||
|
// Description : This typedef is borrowed from dtool/src/dtoolutil, and
|
||||||
|
// stripped down to just the bare minimum that Filename
|
||||||
|
// needs; and also modified to build outside of Panda.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
typedef vector<string> vector_string;
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user