1.9.30 sync.
[gae.git] / java / src / main / com / google / apphosting / utils / config / GenerationDirectory.java
blob2241b06fca31c4ac949c88daeddb38a4b245da50
1 // Copyright 2009 Google Inc. All Rights Reserved.
3 package com.google.apphosting.utils.config;
5 import java.io.File;
7 /**
8 * Utility class to establish the location of generated files, given an
9 * application base directory.
13 public class GenerationDirectory {
15 /**
16 * The directory in which files are generated. The directory
17 * is relative to the WEB-INF folder of the current application.
19 public static final String GENERATED_DIR_PROPERTY = "appengine.generated.dir";
21 /** The default value for {@code GENERATED_DIR_PROPERTY}. */
22 private static final String GENERATED_DIR_DEFAULT = "appengine-generated";
24 /**
25 * Returns the generation directory for the current application.
27 * @param dir location of the application. The default generation directory
28 * will be inside this, if not overridden via the system property
29 * {#link GENERATED_DIR_PROPERTY}.
30 * @return pathname to generated file directory. The directory may
31 * or may not have been created.
33 public static File getGenerationDirectory(File dir) {
34 return new File(System.getProperty(GENERATED_DIR_PROPERTY,
35 new File(new File(dir, "WEB-INF"), GENERATED_DIR_DEFAULT).getPath()));
38 private GenerationDirectory() {