Commit f3b80d03 authored by Mihkel Putrinš's avatar Mihkel Putrinš

fix

parent 0fbae700
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'] var sizes = ['B', 'KB', 'MB', 'GB', 'TB']
function bytesToSize(bytes) { function bytesToSize(bytes) {
if (bytes === undefined or bytes === 0) { return '0 B' } if (bytes === undefined || bytes === 0) { return '0 B' }
try { try {
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10) var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10)
var decimals = Math.max(0, i-1) var decimals = Math.max(0, i-1)
......
...@@ -132,7 +132,8 @@ function recurseLocal(parent_resource, paths, loadedCB) { ...@@ -132,7 +132,8 @@ function recurseLocal(parent_resource, paths, loadedCB) {
if (err) { return callback() } if (err) { return callback() }
if (stats.isFile()) { if (stats.isFile()) {
registerMime(parent_resource, _path, stats.size, callback) registerMime(parent_resource, _path, stats.size, callback)
} else if (stats.isDirectory()) { }
else if (stats.isDirectory()) {
resource_stats.directories.count++ resource_stats.directories.count++
var directory = {name: _path} var directory = {name: _path}
op.push(parent_resource, 'resources', directory) op.push(parent_resource, 'resources', directory)
...@@ -159,12 +160,8 @@ document.getElementById('selectLocalButton').onclick = function selectLocal () { ...@@ -159,12 +160,8 @@ document.getElementById('selectLocalButton').onclick = function selectLocal () {
resource = {name: 'root'} resource = {name: 'root'}
resource_stats = {files: {count: 0, size: 0}, directories: {count: 0}, mime:{}} resource_stats = {files: {count: 0, size: 0}, directories: {count: 0}, mime:{}}
dialog.showOpenDialog({properties:['openFile', 'openDirectory', 'multiSelections']}, function selectedPath(_paths) { dialog.showOpenDialog({properties:['openFile', 'openDirectory', 'multiSelections']}, function selectedPath(_paths) {
if (!_paths) { if (!_paths) { return }
return renderer_interval = setInterval(function () { renderResource() }, 100)
}
renderer_interval = setInterval(function () {
renderResource()
}, 100)
setFormState('loading') setFormState('loading')
if (_paths.length === 1) { if (_paths.length === 1) {
var single_file = _paths[0] var single_file = _paths[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment