forked from olcxjas-softworks/LarpixClient
Update gitignore (sorry)
This commit is contained in:
parent
a8f8c4d7ad
commit
cca8b02fea
6604 changed files with 1219661 additions and 4 deletions
102
electron/node_modules/dir-compare/src/entry/entryBuilder.js
generated
vendored
Normal file
102
electron/node_modules/dir-compare/src/entry/entryBuilder.js
generated
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
var fs = require('fs')
|
||||
var minimatch = require('minimatch')
|
||||
var pathUtils = require('path')
|
||||
var entryComparator = require('./entryComparator')
|
||||
|
||||
var PATH_SEP = pathUtils.sep
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Returns the sorted list of entries in a directory.
|
||||
*/
|
||||
buildDirEntries: function (rootEntry, dirEntries, relativePath, options) {
|
||||
var res = []
|
||||
for (var i = 0; i < dirEntries.length; i++) {
|
||||
var entryName = dirEntries[i]
|
||||
var entryAbsolutePath = rootEntry.absolutePath + PATH_SEP + entryName
|
||||
var entryPath = rootEntry.path + PATH_SEP + entryName
|
||||
|
||||
var entry = this.buildEntry(entryAbsolutePath, entryPath, entryName)
|
||||
if (options.skipSymlinks && entry.isSymlink) {
|
||||
entry.stat = undefined
|
||||
}
|
||||
|
||||
if (filterEntry(entry, relativePath, options)) {
|
||||
res.push(entry)
|
||||
}
|
||||
}
|
||||
return res.sort((a, b) => entryComparator.compareEntry(a, b, options))
|
||||
},
|
||||
|
||||
buildEntry: function (absolutePath, path, name) {
|
||||
var stats = getStatIgnoreBrokenLink(absolutePath)
|
||||
|
||||
return {
|
||||
name: name,
|
||||
absolutePath: absolutePath,
|
||||
path: path,
|
||||
stat: stats.stat,
|
||||
lstat: stats.lstat,
|
||||
isSymlink: stats.lstat.isSymbolicLink(),
|
||||
isBrokenLink: stats.isBrokenLink,
|
||||
isDirectory: stats.stat.isDirectory()
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getStatIgnoreBrokenLink(absolutePath) {
|
||||
var lstat = fs.lstatSync(absolutePath)
|
||||
try {
|
||||
return {
|
||||
stat: fs.statSync(absolutePath),
|
||||
lstat: lstat,
|
||||
isBrokenLink: false
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return {
|
||||
stat: lstat,
|
||||
lstat: lstat,
|
||||
isBrokenLink: true
|
||||
}
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter entries by file name. Returns true if the file is to be processed.
|
||||
*/
|
||||
function filterEntry(entry, relativePath, options) {
|
||||
if (entry.isSymlink && options.skipSymlinks) {
|
||||
return false
|
||||
}
|
||||
var path = pathUtils.join(relativePath, entry.name)
|
||||
|
||||
if ((entry.stat.isFile() && options.includeFilter) && (!match(path, options.includeFilter))) {
|
||||
return false
|
||||
}
|
||||
|
||||
if ((options.excludeFilter) && (match(path, options.excludeFilter))) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches path by pattern.
|
||||
*/
|
||||
function match(path, pattern) {
|
||||
var patternArray = pattern.split(',')
|
||||
for (var i = 0; i < patternArray.length; i++) {
|
||||
var pat = patternArray[i]
|
||||
if (minimatch(path, pat, { dot: true, matchBase: true })) { //nocase
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
20
electron/node_modules/dir-compare/src/entry/entryComparator.js
generated
vendored
Normal file
20
electron/node_modules/dir-compare/src/entry/entryComparator.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Determines order criteria for sorting entries in a directory.
|
||||
*/
|
||||
module.exports = {
|
||||
compareEntry: function (a, b, options) {
|
||||
if (a.isBrokenLink && b.isBrokenLink) {
|
||||
return options.compareNameHandler(a.name, b.name, options)
|
||||
} else if (a.isBrokenLink) {
|
||||
return -1
|
||||
} else if (b.isBrokenLink) {
|
||||
return 1
|
||||
} else if (a.stat.isDirectory() && b.stat.isFile()) {
|
||||
return -1
|
||||
} else if (a.stat.isFile() && b.stat.isDirectory()) {
|
||||
return 1
|
||||
} else {
|
||||
return options.compareNameHandler(a.name, b.name, options)
|
||||
}
|
||||
}
|
||||
}
|
||||
135
electron/node_modules/dir-compare/src/entry/entryEquality.js
generated
vendored
Normal file
135
electron/node_modules/dir-compare/src/entry/entryEquality.js
generated
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
var fs = require('fs')
|
||||
/**
|
||||
* Compares two entries with identical name and type.
|
||||
*/
|
||||
module.exports = {
|
||||
isEntryEqualSync: function (entry1, entry2, type, options) {
|
||||
if (type === 'file') {
|
||||
return isFileEqualSync(entry1, entry2, options)
|
||||
}
|
||||
if (type === 'directory') {
|
||||
return isDirectoryEqual(entry1, entry2, options)
|
||||
}
|
||||
if (type === 'broken-link') {
|
||||
return isBrokenLinkEqual()
|
||||
}
|
||||
throw new Error('Unexpected type ' + type)
|
||||
},
|
||||
|
||||
isEntryEqualAsync: function (entry1, entry2, type, diffSet, options) {
|
||||
if (type === 'file') {
|
||||
return isFileEqualAsync(entry1, entry2, type, diffSet, options)
|
||||
}
|
||||
if (type === 'directory') {
|
||||
return isDirectoryEqual(entry1, entry2, options)
|
||||
}
|
||||
if (type === 'broken-link') {
|
||||
return isBrokenLinkEqual()
|
||||
}
|
||||
throw new Error('Unexpected type ' + type)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function isFileEqualSync(entry1, entry2, options) {
|
||||
var p1 = entry1 ? entry1.absolutePath : undefined
|
||||
var p2 = entry2 ? entry2.absolutePath : undefined
|
||||
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
|
||||
return { same: false, reason: 'different-symlink' }
|
||||
}
|
||||
if (options.compareSize && entry1.stat.size !== entry2.stat.size) {
|
||||
return { same: false, reason: 'different-size' }
|
||||
}
|
||||
if (options.compareDate && !isDateEqual(entry1.stat.mtime, entry2.stat.mtime, options.dateTolerance)) {
|
||||
return { same: false, reason: 'different-date' }
|
||||
}
|
||||
if (options.compareContent && !options.compareFileSync(p1, entry1.stat, p2, entry2.stat, options)) {
|
||||
return { same: false, reason: 'different-content' }
|
||||
}
|
||||
return { same: true }
|
||||
}
|
||||
|
||||
function isFileEqualAsync(entry1, entry2, type, diffSet, options) {
|
||||
var p1 = entry1 ? entry1.absolutePath : undefined
|
||||
var p2 = entry2 ? entry2.absolutePath : undefined
|
||||
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
|
||||
return { same: false, reason: 'different-symlink' }
|
||||
}
|
||||
if (options.compareSize && entry1.stat.size !== entry2.stat.size) {
|
||||
return { same: false, samePromise: undefined, reason: 'different-size' }
|
||||
}
|
||||
|
||||
if (options.compareDate && !isDateEqual(entry1.stat.mtime, entry2.stat.mtime, options.dateTolerance)) {
|
||||
return { same: false, samePromise: undefined, reason: 'different-date' }
|
||||
}
|
||||
|
||||
if (options.compareContent) {
|
||||
var samePromise = undefined
|
||||
var subDiffSet
|
||||
if (!options.noDiffSet) {
|
||||
subDiffSet = []
|
||||
diffSet.push(subDiffSet)
|
||||
}
|
||||
samePromise = options.compareFileAsync(p1, entry1.stat, p2, entry2.stat, options)
|
||||
.then(function (comparisonResult) {
|
||||
var same, error
|
||||
if (typeof (comparisonResult) === "boolean") {
|
||||
same = comparisonResult
|
||||
} else {
|
||||
error = comparisonResult
|
||||
}
|
||||
|
||||
return {
|
||||
entry1: entry1, entry2: entry2, same: same,
|
||||
error: error, type1: type, type2: type,
|
||||
diffSet: subDiffSet,
|
||||
reason: same ? undefined : 'different-content'
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
return {
|
||||
error: error
|
||||
}
|
||||
})
|
||||
|
||||
return { same: undefined, samePromise: samePromise }
|
||||
}
|
||||
|
||||
return { same: true, samePromise: undefined }
|
||||
}
|
||||
|
||||
function isDirectoryEqual(entry1, entry2, options) {
|
||||
if (options.compareSymlink && !isSymlinkEqual(entry1, entry2)) {
|
||||
return { same: false, reason: 'different-symlink' }
|
||||
}
|
||||
return { same: true }
|
||||
}
|
||||
|
||||
function isBrokenLinkEqual() {
|
||||
return { same: false, reason: 'broken-link' } // broken links are never considered equal
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two dates and returns true/false depending on tolerance (milliseconds).
|
||||
* Two dates are considered equal if the difference in milliseconds between them is less or equal than tolerance.
|
||||
*/
|
||||
function isDateEqual(date1, date2, tolerance) {
|
||||
return Math.abs(date1.getTime() - date2.getTime()) <= tolerance ? true : false
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two entries for symlink equality.
|
||||
*/
|
||||
function isSymlinkEqual(entry1, entry2) {
|
||||
if (!entry1.isSymlink && !entry2.isSymlink) {
|
||||
return true
|
||||
}
|
||||
if (entry1.isSymlink && entry2.isSymlink && hasIdenticalLink(entry1.absolutePath, entry2.absolutePath)) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function hasIdenticalLink(path1, path2) {
|
||||
return fs.readlinkSync(path1) === fs.readlinkSync(path2)
|
||||
}
|
||||
18
electron/node_modules/dir-compare/src/entry/entryType.js
generated
vendored
Normal file
18
electron/node_modules/dir-compare/src/entry/entryType.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
module.exports = {
|
||||
/**
|
||||
* One of 'missing','file','directory','broken-link'
|
||||
*/
|
||||
getType: function (entry) {
|
||||
if (!entry) {
|
||||
return 'missing'
|
||||
}
|
||||
if (entry.isBrokenLink) {
|
||||
return 'broken-link'
|
||||
}
|
||||
if (entry.isDirectory) {
|
||||
return 'directory'
|
||||
}
|
||||
return 'file'
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue