File: abs_dirs.patch

package info (click to toggle)
libtuxcap 1.4.0.dfsg2-2.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,176 kB
  • sloc: cpp: 43,203; ansic: 3,095; python: 774; objc: 242; makefile: 100; xml: 87
file content (113 lines) | stat: -rw-r--r-- 4,876 bytes parent folder | download | duplicates (3)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Copyright (C) 2009  Miriam Ruiz <little_miry@yahoo.es>
# Distributed under the same license as the software. See debian/copyright.

--- libtuxcap-1.4.0.orig/tuxcap/lib/ResourceManager.cpp
+++ libtuxcap-1.4.0/tuxcap/lib/ResourceManager.cpp
@@ -191,9 +191,10 @@
 		if (aPath==_S("!program"))
 			theRes->mFromProgram = true;
 	}
+	else if (aPath[0]==_S('/'))
+		theRes->mPath = SexyStringToStringFast(aPath);
 	else
 		theRes->mPath = mDefaultPath + SexyStringToStringFast(aPath);
-
 	
 	std::string anId;
 	XMLParamMap::iterator anItr = theElement.mAttributes.find(_S("id"));
@@ -595,8 +596,9 @@
 bool ResourceManager::ParseResourcesFile(const std::string& theFilename)
 {
 	mXMLParser = new XMLParser();
-	if (!mXMLParser->OpenFile(GetAppResourceFolder() + theFilename))
-		Fail("Resource file not found: " + GetAppResourceFolder() + theFilename);
+	std::string fname = ReplaceBackSlashes(theFilename[0]!='/'? GetAppResourceFolder() + theFilename : theFilename);
+	if (!mXMLParser->OpenFile(fname))
+		Fail("Resource file not found: " + fname);
 
 	XMLElement aXMLElement;
 	while (!mXMLParser->HasFailed())
--- libtuxcap-1.4.0.orig/tuxcap/hgeparticle/hgeparticle.cpp
+++ libtuxcap-1.4.0/tuxcap/hgeparticle/hgeparticle.cpp
@@ -58,7 +58,7 @@
     bInitOK = false;
 
     // LOAD FROM FILE
-    std::string fullfilename = Sexy::ReplaceBackSlashes(Sexy::GetAppResourceFolder() + filename);
+    std::string fullfilename = ReplaceBackSlashes(filename[0]!='/'? GetAppResourceFolder() + filename : std::string(filename));
     FILE *fp = fopen( fullfilename.c_str(), "rb" );
     if( fp == NULL ) 
         return ; 
--- libtuxcap-1.4.0.orig/tuxcap/lib/ImageFont.cpp
+++ libtuxcap-1.4.0/tuxcap/lib/ImageFont.cpp
@@ -1014,7 +1014,7 @@
 
 	bool hasErrors = false;	
 
-        std::string daFontDescFileName = GetAppResourceFolder() + theFontDescFileName;
+	std::string daFontDescFileName = ReplaceBackSlashes(theFontDescFileName[0]!='/'? GetAppResourceFolder() + theFontDescFileName : theFontDescFileName);
 
         daFontDescFileName = ReplaceBackSlashes(daFontDescFileName);
   
@@ -1046,7 +1046,7 @@
 	aFontLayer->mDefaultHeight = aFontLayer->mImage->GetHeight();	
 	aFontLayer->mAscent = aFontLayer->mImage->GetHeight();	
 
-        std::string daFontDescFileName = GetAppResourceFolder() + theFontDescFileName;
+        std::string daFontDescFileName = ReplaceBackSlashes(theFontDescFileName[0]!='/'? GetAppResourceFolder() + theFontDescFileName : theFontDescFileName);
 
         daFontDescFileName = ReplaceBackSlashes(daFontDescFileName);
 
--- libtuxcap-1.4.0.orig/tuxcap/lib/SDLMixerMusicInterface.cpp
+++ libtuxcap-1.4.0/tuxcap/lib/SDLMixerMusicInterface.cpp
@@ -70,7 +70,7 @@
 {
 	SDLMixerMusicInfo aMusicInfo;
 
-        std::string copy = Sexy::ReplaceBackSlashes(GetAppResourceFolder() + theFileName);
+	std::string copy = ReplaceBackSlashes(theFileName[0]!='/'? GetAppResourceFolder() + theFileName : theFileName);
 
 	int aLastDotPos = copy.rfind('.');
 	int aLastSlashPos = (int)copy.rfind('/');
--- libtuxcap-1.4.0.orig/tuxcap/lib/SDLMixerSoundManager.cpp
+++ libtuxcap-1.4.0/tuxcap/lib/SDLMixerSoundManager.cpp
@@ -125,7 +125,7 @@
 	if (!Initialized())
 		return true; // sounds just	won't play, but this is not treated as a failure condition
 
-	std::string aFilename = ReplaceBackSlashes(GetAppResourceFolder() + theFilename);
+	std::string aFilename = ReplaceBackSlashes(theFilename[0]!='/'? GetAppResourceFolder() + theFilename : theFilename);
 
 	mSourceSounds[theSfxID] = Mix_LoadWAV(aFilename.c_str());
 
--- libtuxcap-1.4.0.orig/tuxcap/lib/SexyAppBase.cpp
+++ libtuxcap-1.4.0/tuxcap/lib/SexyAppBase.cpp
@@ -5678,7 +5678,7 @@
 
   std::string resourcepath = GetAppResourceFolder();
   if (!resourcepath.empty()) {
-    if (theFileName.substr(0, resourcepath.size()) == resourcepath)
+    if (theFileName.substr(0, resourcepath.size()) == resourcepath || theFileName[0] == '/')
       aLoadedImage = ImageLib::GetImage(theFileName, true);
     else
       aLoadedImage = ImageLib::GetImage(resourcepath + theFileName, true);
@@ -6167,7 +6167,8 @@
         }
 
         if (!mWindowIconBMP.empty()) {
-            SDL_WM_SetIcon(SDL_LoadBMP((GetAppResourceFolder() + mWindowIconBMP).c_str()), NULL);
+            std::string fname = ReplaceBackSlashes(mWindowIconBMP[0]!='/'? GetAppResourceFolder() + mWindowIconBMP : mWindowIconBMP);
+            SDL_WM_SetIcon(SDL_LoadBMP(fname.c_str()), NULL);
         }
 
     if (mDDInterface->mIs3D) {
@@ -6996,7 +6997,8 @@
 bool SexyAppBase::LoadProperties(const std::string& theFileName, bool required, bool checkSig)
 {
 	Buffer aBuffer;
-	if (!ReadBufferFromFile(GetAppResourceFolder() + theFileName, &aBuffer))
+	std::string fname = ReplaceBackSlashes(theFileName[0]!='/'? GetAppResourceFolder() + theFileName : theFileName);
+	if (!ReadBufferFromFile(fname, &aBuffer))
 	{
 		if (!required)
 			return true;