mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
node8: we can safely use os.tmpdir()
Since we are requiring node >= 8, we can safely use native functionalities.
This commit is contained in:
parent
09949c242a
commit
6d36bb2c53
3 changed files with 4 additions and 10 deletions
|
@ -40,13 +40,7 @@ if(settings.abiword != null)
|
||||||
if(settings.soffice != null)
|
if(settings.soffice != null)
|
||||||
convertor = require("../utils/LibreOffice");
|
convertor = require("../utils/LibreOffice");
|
||||||
|
|
||||||
var tempDirectory = "/tmp";
|
const tempDirectory = os.tmpdir();
|
||||||
|
|
||||||
//tempDirectory changes if the operating system is windows
|
|
||||||
if(os.type().indexOf("Windows") > -1)
|
|
||||||
{
|
|
||||||
tempDirectory = process.env.TEMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do a requested export
|
* do a requested export
|
||||||
|
|
|
@ -47,8 +47,7 @@ if(settings.soffice != null) {
|
||||||
exportExtension = "html";
|
exportExtension = "html";
|
||||||
}
|
}
|
||||||
|
|
||||||
//for node 0.6 compatibily, os.tmpDir() only works from 0.8
|
const tmpDirectory = os.tmpdir();
|
||||||
var tmpDirectory = process.env.TEMP || process.env.TMPDIR || process.env.TMP || '/tmp';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do a requested import
|
* do a requested import
|
||||||
|
|
|
@ -23,7 +23,8 @@ describe('tidyHtml', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to tidy up a bad HTML file
|
// Try to tidy up a bad HTML file
|
||||||
var tmpDir = process.env.TEMP || "/tmp";
|
const tmpDir = os.tmpdir();
|
||||||
|
|
||||||
var tmpFile = path.join(tmpDir, 'tmp_' + (Math.floor(Math.random() * 1000000)) + '.html')
|
var tmpFile = path.join(tmpDir, 'tmp_' + (Math.floor(Math.random() * 1000000)) + '.html')
|
||||||
fs.writeFileSync(tmpFile, '<html><body><p>a paragraph</p><li>List without outer UL</li>trailing closing p</p></body></html>');
|
fs.writeFileSync(tmpFile, '<html><body><p>a paragraph</p><li>List without outer UL</li>trailing closing p</p></body></html>');
|
||||||
TidyHtml.tidy(tmpFile, function(err){
|
TidyHtml.tidy(tmpFile, function(err){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue