code: public static String getPathFromBaseDir(String path) {
          int i = path.indexOf("grails-app/");
          if(i > -1 ) {
              return path.substring(i + 11);
          }
          else {
              try {
                  File baseDir = BuildSettings.BASE_DIR;
                  String basePath = baseDir != null ? baseDir.getCanonicalPath() : null;
                  if(basePath != null) {
                      String canonicalPath = new File(path).getCanonicalPath();
                      return canonicalPath.substring(basePath.length()+1);
                  }
              } catch (IOException e) {
                  // ignore
              }
          }
          return null;
      }
docs: Gets the path relative to the project base directory.
  
  Input: /usr/joe/project/grails-app/conf/BootStrap.groovy
  Output: grails-app/conf/BootStrap.groovy
  
  @param path The path
  @return The path relative to the base directory or null if it can't be established