2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2016-12-30 18:38:06 -05:00
|
|
|
const common = require('../common');
|
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
2017-01-06 19:11:07 -05:00
|
|
|
const assert = require('assert');
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2015-12-02 18:13:27 +01:00
|
|
|
if (!common.isWindows) {
|
2016-05-11 15:34:52 -04:00
|
|
|
common.skip('this test is Windows-specific.');
|
2015-12-02 18:13:27 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-11-25 09:29:06 +01:00
|
|
|
// make a path that will be at least 260 chars long.
|
2017-01-08 13:19:00 +00:00
|
|
|
const fileNameLen = Math.max(260 - common.tmpDir.length - 1, 1);
|
2017-01-30 16:57:49 +08:00
|
|
|
const fileName = path.join(common.tmpDir, 'x'.repeat(fileNameLen));
|
2017-01-08 13:19:00 +00:00
|
|
|
const fullPath = path.resolve(fileName);
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2015-06-09 11:40:55 -07:00
|
|
|
common.refreshTmpDir();
|
2013-03-02 02:43:01 +01:00
|
|
|
|
2012-01-17 19:43:34 +01:00
|
|
|
console.log({
|
|
|
|
filenameLength: fileName.length,
|
|
|
|
fullPathLength: fullPath.length
|
|
|
|
});
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2016-07-15 15:43:24 -04:00
|
|
|
fs.writeFile(fullPath, 'ok', common.mustCall(function(err) {
|
2017-01-06 19:11:07 -05:00
|
|
|
assert.ifError(err);
|
2011-11-25 09:29:06 +01:00
|
|
|
|
2016-07-15 15:43:24 -04:00
|
|
|
fs.stat(fullPath, common.mustCall(function(err, stats) {
|
2017-01-06 19:11:07 -05:00
|
|
|
assert.ifError(err);
|
2016-07-15 15:43:24 -04:00
|
|
|
}));
|
|
|
|
}));
|
2011-11-25 09:29:06 +01:00
|
|
|
|
|
|
|
process.on('exit', function() {
|
2013-02-28 09:18:12 -08:00
|
|
|
fs.unlinkSync(fullPath);
|
2011-11-25 09:29:06 +01:00
|
|
|
});
|