getProperty("java. io. tmpdir"); Commonly, in Windows, the default temporary folder is C:\Temp , %Windows%\Temp , or a temporary directory per user in Local Settings\Temp (this location is usually controlled via the TEMP environment variable).
We can get the temporary file path by displaying the tempnam() function with echo . For example, create a variable $temp_path and assign it with the tempnam() function. Write the sys_get_temp_dir() function as the first parameter to the function and php as the prefix.
When you startup Tomcat, using startup. bat (Windows) or startup.sh , it calls catalina. bat / catalina.sh respectively. Catalina then needs a temp directory to be set. It does this by setting the CATALINA_TMPDIR variable to TOMCAT_HOME\temp folder and assigns it to java system environment variable as java.
NSTemporaryDirectory()
provides a full path to the temporary directory. Instead of using your mainBundle
have you tried
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.pdf"];
If you need a URL instead, do this:
NSURL *furl = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"temp.pdf"]];
Swift 2.0
let tmpDirURL = NSURL.fileURLWithPath(NSTemporaryDirectory(),isDirectory: true)
let fileURL = tmpDirURL.URLByAppendingPathComponent("stuff").URLByAppendingPathExtension("gif")
print("FilePath: \(fileURL.path)")
For Swift 3.0
var fileUrl: URL = URL(fileURLWithPath: NSTemporaryDirectory())
fileUrl.appendPathComponent("foo")
fileUrl.appendPathExtension("bar")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With