private static Resource getDeployDirectory(Config config) {
    Resource dir = ConfigWebUtil.getConfigServerDirectory(config);
    if (dir == null || !dir.isWriteable() || !dir.isReadable())
      dir =
          ResourceUtil.toResource(
              CFMLEngineFactory.getClassLoaderRoot(SystemUtil.getLoaderClassLoader()));

    return dir;
  }
Exemple #2
0
 /** @return return System directory */
 public static Resource getSystemDirectory() {
   String pathes = System.getProperty("java.library.path");
   ResourceProvider fr = ResourcesImpl.getFileResourceProvider();
   if (pathes != null) {
     String[] arr = ListUtil.toStringArrayEL(ListUtil.listToArray(pathes, File.pathSeparatorChar));
     for (int i = 0; i < arr.length; i++) {
       if (arr[i].toLowerCase().indexOf("windows\\system") != -1) {
         Resource file = fr.getResource(arr[i]);
         if (file.exists() && file.isDirectory() && file.isWriteable())
           return ResourceUtil.getCanonicalResourceEL(file);
       }
     }
     for (int i = 0; i < arr.length; i++) {
       if (arr[i].toLowerCase().indexOf("windows") != -1) {
         Resource file = fr.getResource(arr[i]);
         if (file.exists() && file.isDirectory() && file.isWriteable())
           return ResourceUtil.getCanonicalResourceEL(file);
       }
     }
     for (int i = 0; i < arr.length; i++) {
       if (arr[i].toLowerCase().indexOf("winnt") != -1) {
         Resource file = fr.getResource(arr[i]);
         if (file.exists() && file.isDirectory() && file.isWriteable())
           return ResourceUtil.getCanonicalResourceEL(file);
       }
     }
     for (int i = 0; i < arr.length; i++) {
       if (arr[i].toLowerCase().indexOf("win") != -1) {
         Resource file = fr.getResource(arr[i]);
         if (file.exists() && file.isDirectory() && file.isWriteable())
           return ResourceUtil.getCanonicalResourceEL(file);
       }
     }
     for (int i = 0; i < arr.length; i++) {
       Resource file = fr.getResource(arr[i]);
       if (file.exists() && file.isDirectory() && file.isWriteable())
         return ResourceUtil.getCanonicalResourceEL(file);
     }
   }
   return null;
 }
 private static Resource getBinDirectory(Config config) {
   Resource dir = ConfigWebUtil.getConfigServerDirectory(config);
   if (dir == null || !dir.isWriteable() || !dir.isReadable())
     dir =
         ResourceUtil.toResource(
             CFMLEngineFactory.getClassLoaderRoot(SystemUtil.getLoaderClassLoader()));
   else {
     dir = dir.getRealResource("bin");
     if (!dir.exists()) dir.mkdir();
   }
   return dir;
 }