Java Temp Directory Get getTempDirWithFileSeparatorSuffix()

Here you can find the source of getTempDirWithFileSeparatorSuffix()

Description

Get the platform dependent temporary directory path, with 'file separator' suffix('/' on linux platform, '\' on windows).

License

Open Source License

Declaration

public static String getTempDirWithFileSeparatorSuffix() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 pf_miles./*from w w  w.  j  a  va2 s  .c  om*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     pf_miles - initial API and implementation
 ******************************************************************************/

import java.io.File;

public class Main {
    /**
     * Get the platform dependent temporary directory path, with 'file
     * separator' suffix('/' on linux platform, '\' on windows).
     * 
     * @return
     */
    public static String getTempDirWithFileSeparatorSuffix() {
        String p = System.getProperty("java.io.tmpdir");
        if (p.endsWith(File.separator))
            return p;
        return p + File.separator;
    }
}

Related

  1. getTempDirFile()
  2. getTempDirFilePath(String name)
  3. getTempDirName()
  4. getTempDirURL()
  5. getTempDirValue()