Browse Source

Fixed loadBMK to work for local app folder.

git-svn-id: http://bmkng.googlecode.com/svn/trunk@20 2a3afde7-ceff-d69e-269d-2b6c215c828a
[email protected] 14 years ago
parent
commit
556db54902
4 changed files with 22 additions and 6 deletions
  1. 1 0
      bmk.bmx
  2. 1 1
      bmk_config.bmx
  3. 1 1
      bmk_modutil.bmx
  4. 19 4
      bmk_ng.bmx

+ 1 - 0
bmk.bmx

@@ -1,5 +1,6 @@
 '
 '
 ' Change History :
 ' Change History :
+' 2.09 30/04/2010 - Fixed loadBMK to work for local app folder.
 ' 2.08 05/04/2010 - Added Tommo's include speedup fix.
 ' 2.08 05/04/2010 - Added Tommo's include speedup fix.
 '                   Fixed PPC universal link issue.
 '                   Fixed PPC universal link issue.
 ' 2.07 28/01/2010 - Fixed win32 linking to include libmingw32 both at the start and end of the list. (should cover 3.9.5 and 4.x gcc's)
 ' 2.07 28/01/2010 - Fixed win32 linking to include libmingw32 both at the start and end of the list. (should cover 3.9.5 and 4.x gcc's)

+ 1 - 1
bmk_config.bmx

@@ -5,7 +5,7 @@ Import BRL.MaxUtil
 
 
 Import Pub.MacOS
 Import Pub.MacOS
 
 
-Const BMK_VERSION:String = "2.08"
+Const BMK_VERSION:String = "2.09"
 
 
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc"
 Const ALL_SRC_EXTS$="bmx;i;c;m;h;cpp;cxx;mm;hpp;hxx;s;cc"
 
 

+ 1 - 1
bmk_modutil.bmx

@@ -180,7 +180,7 @@ Function ParseSourceFile:TSourceFile( path$ )
 				file.pragmas.AddLast pragmaLine[i..]
 				file.pragmas.AddLast pragmaLine[i..]
 			End If
 			End If
 
 
-			If Not CharIsAlpha( lline[0] ) Continue
+			If lline.length And Not CharIsAlpha( lline[0] ) Continue
 
 
 			i=1
 			i=1
 			While i<lline.length And (CharIsAlpha(lline[i]) Or CharIsDigit(lline[i]))
 			While i<lline.length And (CharIsAlpha(lline[i]) Or CharIsDigit(lline[i]))

+ 19 - 4
bmk_ng.bmx

@@ -49,20 +49,31 @@ Type TBMK
 
 
 	' loads a .bmk, stores any functions, and runs any commands.
 	' loads a .bmk, stores any functions, and runs any commands.
 	Method LoadBMK(path:String)
 	Method LoadBMK(path:String)
-
 		Local str:String
 		Local str:String
 		Try
 		Try
 			If FileType(path) = 1 Then
 			If FileType(path) = 1 Then
 				str = LoadText( path )
 				str = LoadText( path )
 			Else
 			Else
-				Return
+				If FileType(AppDir + "/" + path) = 1 Then
+					str = LoadText( AppDir + "/" + path )
+				Else
+					If FileType(globals.Get("BUILDPATH") + "/" + path) = 1 Then
+						str = LoadText(globals.Get("BUILDPATH") + "/" + path )
+					Else
+						Return
+					End If
+				End If
 			End If
 			End If
 		Catch e:Object
 		Catch e:Object
 			Try
 			Try
 				If FileType(AppDir + "/" + path) = 1 Then
 				If FileType(AppDir + "/" + path) = 1 Then
 					str = LoadText( AppDir + "/" + path )
 					str = LoadText( AppDir + "/" + path )
 				Else
 				Else
-					Return
+					If FileType(globals.Get("BUILDPATH") + "/" + path) = 1 Then
+						str = LoadText(globals.Get("BUILDPATH") + "/" + path )
+					Else
+						Return
+					End If
 				End If
 				End If
 			Catch e:Object
 			Catch e:Object
 				' we tried... twice
 				' we tried... twice
@@ -70,7 +81,7 @@ Type TBMK
 				Return
 				Return
 			End Try
 			End Try
 		End Try
 		End Try
-	
+
 		Local pos:Int, inDefine:Int, text:String, name:String
 		Local pos:Int, inDefine:Int, text:String, name:String
 	
 	
 		While pos < str.length
 		While pos < str.length
@@ -395,6 +406,7 @@ Type TBMKGlobals
 
 
 	' sets the variable with value
 	' sets the variable with value
 	Method SetVar(variable:String, value:Object)
 	Method SetVar(variable:String, value:Object)
+'Print "SetVar : " + variable + " : " + String(value)
 		vars.Insert(variable.ToUpper(), value)
 		vars.Insert(variable.ToUpper(), value)
 	End Method
 	End Method
 	
 	
@@ -402,6 +414,9 @@ Type TBMKGlobals
 	Method Get:String(variable:String)
 	Method Get:String(variable:String)
 		Local obj:Object = vars.ValueForKey(variable.ToUpper())
 		Local obj:Object = vars.ValueForKey(variable.ToUpper())
 		If obj Then
 		If obj Then
+			If String(obj) Then
+				Return String(obj)
+			End If
 			Return obj.ToString()
 			Return obj.ToString()
 		End If
 		End If
 	End Method
 	End Method