@@ -14,25 +14,22 @@ class Routines:
1414 __packageName = 'dbdiffchecker'
1515 __distrJarDir = 'lib'
1616 __logFileDir = 'logs'
17+ __mainClassFile = 'DB_Diff_Checker_GUI'
1718
1819 #__init__ is the constructor which initializes all instance variables
1920 def __init__ (self ):
20- #sets the class path for later use
21- #get current jar list and add it to the Class-Path
22- filelist = [fi for fi in os .listdir (os .path .join (os .getcwd (), self .getJarPath ())) if fi .endswith ('.jar' )]
23- for fi in filelist :
24- self .__javaCP += "\" .;" + os .path .join (self .getJarPath (), fi ) + "\" ;"
25- self .__javaCP = self .__javaCP [:- 1 ]
21+ #set up the class path for later use
22+ self .__javaCP = "\" .;" + os .path .join (self .getJarPath (), '*' ) + "\" "
2623 return None
2724
25+ #getMainClassFile gets the name of the file that has the main class
26+ def getMainClassFile (self ):
27+ return self .__mainClassFile
28+
2829 #getLogFileDirectory gets the name of the log file directory
2930 def getLogFileDirectory (self ):
3031 return self .__logFileDir
3132
32- #getDistributionJarDirectory gets the distribution directory for the JAR files
33- def getDistributionJarDirectory (self ):
34- return self .__distrJarDir
35-
3633 #getDebugPath retruns a string, which is the path to the debug file destination
3734 #from a level above where this script is
3835 def getDebugPath (self ):
@@ -84,9 +81,7 @@ def makeJar(self):
8481 #compile the java files and make the jar file
8582 if (self .compile (packageName , False )):
8683 call ('jar cvfm ' + os .path .join (buildDir , 'Db_Diff_Checker.jar' ) + ' manifest.mf ' +
87- packageName + ' Images ' + self .getJarPath (), shell = True )
88- #remove unnecesssary directory
89- self .__removeDirectory (os .path .join (buildDir , logDir ))
84+ packageName + ' Images ' , shell = True )
9085 #remove unnecesssary .class files
9186 filelist = [f for f in os .listdir (os .path .join (os .getcwd (), self .getPackageName ())) if f .endswith ('.class' )]
9287 for f in filelist :
@@ -101,7 +96,7 @@ def debug(self):
10196 testDir = self .getDebugPath ()
10297 #run compiled files with classPath
10398 if (self .compile (testDir , True )):
104- call ('java -cp ' + os .path .join (testDir , ' ' ) + self .getPackageName () + '.DB_Diff_Checker_GUI' , shell = True ) #needs an update...
99+ call ('java -cp ' + self . getClassPath () + ';' + os .path .join (testDir , ' ' ) + self .getPackageName () + '.' + self . getMainClassFile () , shell = True ) #needs an update...
105100
106101 return None
107102
@@ -113,11 +108,12 @@ def updateManifest(self):
113108 f .write ("Manifest-Version: 1.0\n " )
114109 f .write ("Ant-Version: Apache Ant 1.9.7\n " )
115110 cP = 'Class-Path: '
116- mC = 'Main-Class: ' + self .getPackageName () + '.DB_Diff_Checker_GUI'
111+ mC = 'Main-Class: ' + self .getPackageName () + '.' + self . getMainClassFile ()
117112 #get current jar list and add it to the Class-Path
118113 filelist = [fi for fi in os .listdir (os .path .join (os .getcwd (), self .getJarPath ())) if fi .endswith ('.jar' )]
119114 for fi in filelist :
120- cP += os .path .join (self .getDistributionJarDirectory (), fi ) + ' '
115+ copy (os .path .join (self .getJarPath (), fi ), os .path .join (self .getDistrubutionPath (), os .path .join (self .getJarPath (), fi )))
116+ cP += os .path .join (self .getJarPath (), fi ) + ' '
121117 #Class-Path is added if a jar file was found
122118 if (cP != 'Class-Path: ' ):
123119 f .write (cP + "\n " )
@@ -196,6 +192,10 @@ def createBuild(self):
196192 os .mkdir (buildFolder )
197193 except :
198194 pass
195+ try :
196+ os .mkdir (os .path .join (buildFolder , self .getJarPath ()))
197+ except :
198+ pass
199199 self .createLogs ()
200200
201201def main ():
0 commit comments