Permalink
Browse files

[#1086] Recursively add jars to the classpath inside app lib folder t…

…o allow for subdirectories
  • Loading branch information...
1 parent fb2931d commit c68fe835c6a4faa532d15f139edafdd4579e2d6e Brian Nesbitt committed Aug 31, 2011
Showing with 16 additions and 4 deletions.
  1. +16 −4 framework/pym/play/application.py
View
20 framework/pym/play/application.py
@@ -112,18 +112,30 @@ def name(self):
# ~~~~~~~~~~~~~~~~~~~~~~ JAVA
+ def find_and_add_all_jars(self, classpath, dir):
+
+ # ignore dirs that start with ".", example: .svn
+ if dir.find(".") == 0:
+ return
+
+ for file in os.listdir(dir):
+ fullPath = os.path.normpath(os.path.join(dir,file))
+ if os.path.isdir(fullPath):
+ self.find_and_add_all_jars(classpath, fullPath)
+ else:
+ if fullPath.endswith('.jar'):
+ classpath.append(fullPath)
+
def getClasspath(self):
classpath = []
# The default
classpath.append(os.path.normpath(os.path.join(self.path, 'conf')))
classpath.append(os.path.normpath(os.path.join(self.play_env["basedir"], 'framework/play-%s.jar' % self.play_env['version'])))
- # The application
+ # The application - recursively add jars to the classpath inside the lib folder to allow for subdirectories
if os.path.exists(os.path.join(self.path, 'lib')):
- for jar in os.listdir(os.path.join(self.path, 'lib')):
- if jar.endswith('.jar'):
- classpath.append(os.path.normpath(os.path.join(self.path, 'lib/%s' % jar)))
+ self.find_and_add_all_jars(classpath, os.path.join(self.path, 'lib'))
# The modules
for module in self.modules():

0 comments on commit c68fe83

Please sign in to comment.