httl.properties: code.directory=/tmp/javacode
498852
public void setCodeDirectory(String codeDirectory) {
        if (codeDirectory != null && codeDirectory.trim().length() > 0) {
            File file = new File(codeDirectory);
            if (file.exists() || file.mkdirs()) {
                this.codeDirectory = file;
            }
        }
    }
1170439
def __mktmp(self):
        """"""
        try:
            if not os.path.isdir(self.location):
                os.makedirs(self.location)
        except Exception:
            log.debug(self.location, exc_info=1)
        return self
1186617
public static String getDumpFileDirectoryName(
			DumpContentType dumpContentType, String dateStamp) {
		return dumpContentType.toString().toLowerCase() + "-" + dateStamp;
	}
1178436
function setupTempDir(tmpDir) {
  var rpmStructure = ['BUILD', 'BUILDROOT', 'RPMS', 'SOURCES', 'SPECS', 'SRPMS'];

  // If the tmpDir exists (probably from previous build), delete it first
  if (fsx.existsSync(tmpDir)) {
    logger(chalk.cyan('Removing old temporary directory.'));
    fsx.removeSync(tmpDir);
  }

  // Create RPM folder structure
  logger(chalk.cyan('Creating RPM directory structure at:'), tmpDir);
  _.forEach(rpmStructure, function(dirName) {
    fsx.mkdirpSync(path.join(tmpDir, dirName));
  });
}
1144475
public static void emitCode(File outputFolder, String fileName, String code)
	{
		emitCode(outputFolder, fileName, code, "UTF-8");
	}
576254
public static String tmpDirName()
    {
        String tmpDirName = System.getProperty("java.io.tmpdir");
        if (!tmpDirName.endsWith(File.separator))
        {
            tmpDirName += File.separator;
        }

        return tmpDirName;
    }
1337090
public void doDynamic(StaplerRequest request, StaplerResponse response) throws ServletException, IOException {
        if (("/" + originalFileName).equals(request.getRestOfPath())) {
            AbstractBuild build = (AbstractBuild)request.findAncestor(AbstractBuild.class).getObject();
            File fileParameter = getLocationUnderBuild(build);

            if (!ALLOW_FOLDER_TRAVERSAL_OUTSIDE_WORKSPACE) {
                File fileParameterFolder = getFileParameterFolderUnderBuild(build);

                //TODO can be replaced by Util#isDescendant in 2.80+
                Path child = fileParameter.getAbsoluteFile().toPath().normalize();
                Path parent = fileParameterFolder.getAbsoluteFile().toPath().normalize();
                if (!child.startsWith(parent)) {
                    throw new IllegalStateException("The fileParameter tried to escape the expected folder: " + location);
                }
            }

            if (fileParameter.isFile()) {
                try (InputStream data = Files.newInputStream(fileParameter.toPath())) {
                    long lastModified = fileParameter.lastModified();
                    long contentLength = fileParameter.length();
                    if (request.hasParameter("view")) {
                        response.serveFile(request, data, lastModified, contentLength, "plain.txt");
                    } else {
                        response.serveFile(request, data, lastModified, contentLength, originalFileName);
                    }
                } catch (InvalidPathException e) {
                    throw new IOException(e);
                }
            }
        }
    }
1053789
private void mkDir(String dir) throws Exception {
        Session session = getSession();
        session.connect();
        Channel channel = session.openChannel("sftp");
        channel.connect();

        ChannelSftp c = (ChannelSftp) channel;
        if (!fileExists(dir, c))
            c.mkdir(dir);
        c.exit();
        session.disconnect();
    }
1105175
public void writeTo(Path directory) throws IOException {
    checkArgument(Files.notExists(directory) || Files.isDirectory(directory),
        "path %s exists but is not a directory.", directory);
    Path outputDirectory = directory;
    if (!packageName.isEmpty()) {
      for (String packageComponent : packageName.split("\\.")) {
        outputDirectory = outputDirectory.resolve(packageComponent);
      }
      Files.createDirectories(outputDirectory);
    }

    Path outputPath = outputDirectory.resolve(typeSpec.name + ".java");
    try (Writer writer = new OutputStreamWriter(Files.newOutputStream(outputPath), UTF_8)) {
      writeTo(writer);
    }
  }
747691
function addCode(script, match, filePath) {
  var leftDeli = match[1], code = match[2];
  if(leftDeli==='<@' || leftDeli==='<!--@='){
    script.push('__p(escape(' + code + '));');
  }
  else if(leftDeli==='<@|' || leftDeli==='<!--@|'){//no escape
    script.push('__p(' + code + ');');
  }
  else{//<!--@ -->
    script.push(code);

    //possible single-line comment check
    var lastLine = code.split('\n').slice(-1)[0];
    if(lastLine.indexOf('//')>=0){
      /*eslint-disable no-console*/
      if(!filePath) console.warn('detect a possible single-line comment: %s', lastLine);
      else console.warn('detect a possible single-line comment in file %s: %s', filePath, lastLine);
      /*eslint-enable no-console*/
    }
    if(code.slice(-1)!==';') script.push(';');
  }
}
840735
def serve_dtool_directory(directory, port):
    """"""
    os.chdir(directory)
    server_address = ("localhost", port)
    httpd = DtoolHTTPServer(server_address, DtoolHTTPRequestHandler)
    httpd.serve_forever()
275387
@Override
	public URI locateModuleResource(String mid, boolean isJavaScript) {
		Location location = null;
		String remainder = null;

		// Now see if mid matches exactly a path
		if (getPaths().containsKey(mid)) {
			location = getPaths().get(mid);
		}
		// If the module is a package name, then resolve to the packag main id
		if (location == null && getPackages().containsKey(mid)) {
			mid = getPackages().get(mid).getMain();
		}
		if (location == null) {
			// Still no match.  Iterate through the paths and packages looking
			// for an entry that matches part of the module id
			String prefix = ""; //$NON-NLS-1$
			for (Map.Entry<String, Location> entry : getPaths().entrySet()) {
				if (mid.startsWith(entry.getKey()) && entry.getKey().length() > prefix.length()) {
					if (entry.getKey().endsWith("/") || mid.charAt(entry.getKey().length()) == '/') { //$NON-NLS-1$
						prefix = entry.getKey();
						location = entry.getValue();
					}
				}
			}
			for (Map.Entry<String, IPackage> entry : getPackages().entrySet()) {
				if (mid.startsWith(entry.getKey()) && entry.getKey().length() > prefix.length()) {
					if (entry.getKey().endsWith("/") || mid.charAt(entry.getKey().length()) == '/') { //$NON-NLS-1$
						prefix = entry.getKey();
						location = entry.getValue().getLocation();
					}
				}
			}
			if (prefix.length() > 0) {
				// We found a partial match.  Set the remainder
				remainder = mid.substring(prefix.length());
				if (remainder.startsWith("/")) { //$NON-NLS-1$
					remainder = remainder.substring(1);
				}
				// Check for illegal relative path. Throws exception if an
				// attempt is made to use relitive path components to go
				// outside the path defined by the entry.
				PathUtil.normalizePaths(prefix, new String[]{remainder});
			} else {
				// Check for illegal relative path. Throws exception if an
				// attempt is made to use relitive path components to go
				// outside the path defined by the base url.
				PathUtil.normalizePaths("", new String[]{mid});  //$NON-NLS-1$
				// not match.  Return a URI relative to the config base URI
				Location base = getBase();
				location = new Location(
						base.getPrimary().resolve(mid),
						base.getOverride() == null ? null : base.getOverride().resolve(mid)
						);
			}
		}
		URI result = null;
		try {
			URI override = toResourceUri(location.getOverride(), remainder, isJavaScript);
			result = (override != null && aggregator.newResource(override).exists()) ?
					override : toResourceUri(location.getPrimary(), remainder, isJavaScript);

		} catch (URISyntaxException e) {
			if (log.isLoggable(Level.WARNING)) {
				log.log(Level.WARNING, e.getMessage(), e);
			}
		}

		return result;
	}
610177
void genCode() throws IOException {
        if (!outputDirectory.exists()) {
            if (!outputDirectory.mkdirs()) {
                throw new IOException("unable to create output directory "
                        + outputDirectory);
            }
        }
        FileWriter c = new FileWriter(new File(outputDirectory, mName + ".c"));
        FileWriter h = new FileWriter(new File(outputDirectory, mName + ".h"));

        h.write("/**\n");
        h.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
        h.write("* or more contributor license agreements.  See the NOTICE file\n");
        h.write("* distributed with this work for additional information\n");
        h.write("* regarding copyright ownership.  The ASF licenses this file\n");
        h.write("* to you under the Apache License, Version 2.0 (the\n");
        h.write("* \"License\"); you may not use this file except in compliance\n");
        h.write("* with the License.  You may obtain a copy of the License at\n");
        h.write("*\n");
        h.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
        h.write("*\n");
        h.write("* Unless required by applicable law or agreed to in writing, software\n");
        h.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
        h.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
        h.write("* See the License for the specific language governing permissions and\n");
        h.write("* limitations under the License.\n");
        h.write("*/\n");
        h.write("\n");

        c.write("/**\n");
        c.write("* Licensed to the Apache Software Foundation (ASF) under one\n");
        c.write("* or more contributor license agreements.  See the NOTICE file\n");
        c.write("* distributed with this work for additional information\n");
        c.write("* regarding copyright ownership.  The ASF licenses this file\n");
        c.write("* to you under the Apache License, Version 2.0 (the\n");
        c.write("* \"License\"); you may not use this file except in compliance\n");
        c.write("* with the License.  You may obtain a copy of the License at\n");
        c.write("*\n");
        c.write("*     http://www.apache.org/licenses/LICENSE-2.0\n");
        c.write("*\n");
        c.write("* Unless required by applicable law or agreed to in writing, software\n");
        c.write("* distributed under the License is distributed on an \"AS IS\" BASIS,\n");
        c.write("* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");
        c.write("* See the License for the specific language governing permissions and\n");
        c.write("* limitations under the License.\n");
        c.write("*/\n");
        c.write("\n");

        h.write("#ifndef __" + mName.toUpperCase().replace('.', '_') + "__\n");
        h.write("#define __" + mName.toUpperCase().replace('.', '_') + "__\n");

        h.write("#include \"recordio.h\"\n");
        for (Iterator<JFile> i = mInclFiles.iterator(); i.hasNext();) {
            JFile f = i.next();
            h.write("#include \"" + f.getName() + ".h\"\n");
        }
        // required for compilation from C++
        h.write("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");

        c.write("#include <stdlib.h>\n"); // need it for calloc() & free()
        c.write("#include \"" + mName + ".h\"\n\n");

        for (Iterator<JRecord> i = mRecList.iterator(); i.hasNext();) {
            JRecord jr = i.next();
            jr.genCCode(h, c);
        }

        h.write("\n#ifdef __cplusplus\n}\n#endif\n\n");
        h.write("#endif //" + mName.toUpperCase().replace('.', '_') + "__\n");

        h.close();
        c.close();
    }
465215
@SuppressWarnings("unchecked")
    private <T> T jndiLookup(PropertyKey propertyKey) {
        String property = properties.getProperty(propertyKey.getKey());
        if (property != null) {
            return isJndiLazyLookup() ?
                    (T) LazyJndiResolver.newInstance(property, DataSource.class) :
                    (T) JndiUtils.lookup(property);
        }
        return null;
    }
194432
public static String getTempDir() {
        synchronized (FileUtil.class) {
            if (TEMP_DIR == null) {
                // Get the 'java.io.tmpdir' property
                String tmpDir = System.getProperty("java.io.tmpdir");

                if (StringUtil.isEmpty(tmpDir)) {
                    // Stupid fallback...
                    // TODO: Delegate to FileSystem?
                    if (new File("/temp").exists()) {
                        tmpDir = "/temp";  // Windows
                    }
                    else {
                        tmpDir = "/tmp";   // Unix
                    }
                }
                TEMP_DIR = tmpDir;
            }
        }
        return TEMP_DIR;
    }
1165123
public String getStartSourceCode(String packagePath, String strFileName, String strDescription, boolean bResourceListBundle)
    {
        String string;
        if (bResourceListBundle)
        {
            string =
                "package " + packagePath + ";\n"
                + "/**\n"
                + " * @(#)" + strFileName + ".java  0.00 1-Jan-10 Don Corley\n"
                + " *\n"
                + " * Copyright © 2010 tourgeek.com. All Rights Reserved.\n"
                + " *   don@donandann.com\n"
                + " */\n"
                + "import java.util.*;\n"
                + "\n"
                + "/**\n"
                + " * " + strFileName + " - Resources.\n"
                + strDescription + "\n"
                + " */\n"
                + "public class " + strFileName + " extends ListResourceBundle\n"
                + "{\n"
                + "\tpublic Object[][] getContents() {\n"
                + "\t\treturn contents;\n"
                + "\t}\n";
        }
        else
            string = "# " + strFileName + " property file" + "\n" + "# " + strDescription + "\n";
        return string;
    }
1095667
private ProjectFile handleDatabaseInDirectory(File directory) throws Exception
   {
      byte[] buffer = new byte[BUFFER_SIZE];
      File[] files = directory.listFiles();
      if (files != null)
      {
         for (File file : files)
         {
            if (file.isDirectory())
            {
               continue;
            }

            FileInputStream fis = new FileInputStream(file);
            int bytesRead = fis.read(buffer);
            fis.close();

            //
            // If the file is smaller than the buffer we are peeking into,
            // it's probably not a valid schedule file.
            //
            if (bytesRead != BUFFER_SIZE)
            {
               continue;
            }

            if (matchesFingerprint(buffer, BTRIEVE_FINGERPRINT))
            {
               return handleP3BtrieveDatabase(directory);
            }

            if (matchesFingerprint(buffer, STW_FINGERPRINT))
            {
               return handleSureTrakDatabase(directory);
            }
         }
      }
      return null;
   }