ebcd261201
Upstream changes: 5+ years of development; try these links: http://www.shatters.net/celestia/161changes.txt http://www.shatters.net/celestia/features/160-features.html http://www.shatters.net/celestia/151changes.txt http://www.shatters.net/celestia/150-feature-summary.html Restrictions: 1. The Lua support still does not build, and given that I had to patch it to compile at all with Lua disabled it may not work all that well this way. 2. The optional KDE (kde3) build is almost certainly broken; I will get to this in a few days if nobody beats me to it.
71 lines
1.5 KiB
Text
71 lines
1.5 KiB
Text
$NetBSD: patch-am,v 1.3 2013/10/27 21:21:26 dholland Exp $
|
|
|
|
- dragonfly doesn't have wordexp.h
|
|
- use glob.h instead of wordexp.h when not using wordexp.h
|
|
|
|
--- src/celutil/unixdirectory.cpp.orig 2011-06-05 16:11:15.000000000 +0000
|
|
+++ src/celutil/unixdirectory.cpp
|
|
@@ -11,20 +11,30 @@
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
-#include <wordexp.h>
|
|
-#include "directory.h"
|
|
-
|
|
-using namespace std;
|
|
|
|
+#if defined(__DragonFly__)
|
|
+#define NO_WORDEXP
|
|
+#endif
|
|
|
|
#ifdef TARGET_OS_MAC
|
|
#ifdef QT_CORE_LIB
|
|
// Crash on Mac OS X / Qt4 version when calling wordfree.
|
|
// This seems to happen only with Leopard.
|
|
-#define WORDEXP_PROBLEM
|
|
+#define NO_WORDEXP
|
|
+#endif
|
|
#endif
|
|
+
|
|
+#ifdef NO_WORDEXP
|
|
+#include <glob.h>
|
|
+#else
|
|
+#include <wordexp.h>
|
|
#endif
|
|
|
|
+#include "directory.h"
|
|
+
|
|
+using namespace std;
|
|
+
|
|
+
|
|
class UnixDirectory : public Directory
|
|
{
|
|
public:
|
|
@@ -107,7 +117,7 @@ bool IsDirectory(const std::string& file
|
|
|
|
std::string WordExp(const std::string& filename)
|
|
{
|
|
-#ifndef WORDEXP_PROBLEM
|
|
+#ifndef NO_WORDEXP
|
|
wordexp_t result;
|
|
std::string expanded;
|
|
|
|
@@ -130,7 +140,17 @@ std::string WordExp(const std::string& f
|
|
expanded = result.we_wordv[0];
|
|
wordfree(&result);
|
|
#else
|
|
- std::string expanded = filename;
|
|
+ glob_t g;
|
|
+ std::string expanded;
|
|
+ glob(filename.c_str(), GLOB_NOSORT | GLOB_TILDE, NULL, &g);
|
|
+ if (g.gl_matchc != 1) {
|
|
+ globfree(&g);
|
|
+ return filename;
|
|
+ } else {
|
|
+ expanded = g.gl_pathv[0];
|
|
+ globfree(&g);
|
|
+ return expanded;
|
|
+ }
|
|
#endif
|
|
return expanded;
|
|
}
|