Working on opening local files

This commit is contained in:
Scott Idem
2022-03-10 18:19:35 -05:00
parent f0bf184a4a
commit 437b9af482
5 changed files with 136 additions and 10 deletions

View File

@@ -60,7 +60,7 @@
background-color: hsla(0,0%,100%,.98);
font-size: 1.1em;
padding-right: .1em;
border-right: solid medium hsla(0,0%,90%,1);
@@ -125,7 +125,7 @@
.event_launcher_main_nav_menu .btn {
min-width: 100%;
max-width: 100%;
border-radius: .25em;
margin: .1em 0em;
}
@@ -145,7 +145,7 @@
text-align: center;
font-size: .7em;
min-width: 5em;
margin: .1em .2em;
}
@@ -173,6 +173,39 @@
z-index: 500;
}
.event_launcher_status {
outline: dashed thin red;
margin: .1em .4em;
padding: .0em;
position: fixed;
bottom: 0;
right: 0;
/* width: 12em; */
z-index: 500;
display: flex;
flex-direction: row;
/* flex-wrap: nowrap; */
justify-content: center;
align-items: center;
align-content: center;
font-size: .7em;
}
.event_launcher_status:hover {
font-size: 1.1em;
font-weight: bold;
}
.event_launcher_status > .network_status {
margin: .2em .2em;
}
.event_launcher_status > .current_datetime {
margin: .2em .2em;
}
.event_launcher_main_content header.event_session_about {
@@ -243,17 +276,17 @@ ul.event_presentation_list .btn_list>li {
.event_launcher_main_content .event_presentation_datetime_name .event_presentation_datetime {
/*align-self: flex-start;*/
/*border-right: dashed thin green;*/
text-align: center;
font-size: .7em;
min-width: 5em;
margin: .1em .2em;
}
.event_launcher_main_content .event_presentation_datetime_name .event_presentation_name {
border-left: solid thin gray;
margin: .1em .2em;
padding-left: .2em;
}

View File

@@ -71,6 +71,25 @@ exports.load_config = function () {
}
// Check for local file
// Updated 2022-03-10
exports.check_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: check_local_file() ***');
console.log('Check for local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
let full_local_file_path = path.join(local_file_path, filename);
console.log(full_local_file_path);
if (fs.existsSync(full_local_file_path)) {
console.log(`Local file exists: ${full_local_file_path}`);
return true;
} else {
return false;
}
}
// Check local hash file cache
// Updated 2022-03-09
exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) {
@@ -84,13 +103,15 @@ exports.check_hash_file_cache = async function ({host_file_cache_path, hash}) {
// console.log(hash_file_cache_path);
if (fs.existsSync(hash_file_cache_path)) {
console.log(`Hashed file cache already exists: ${hash_file_cache_path}`);
console.log(`Hashed file exists in cache: ${hash_file_cache_path}`);
return true;
} else {
console.log(`Hashed file not found in cache: ${hash_file_cache_path}`);
return false;
}
}
// Download hash file to cache
// Updated 2022-03-09
exports.download_hash_file_to_cache = async function ({host_file_cache_path, event_file_id=null, hash=null}) {
@@ -121,8 +142,9 @@ exports.download_hash_file_to_cache = async function ({host_file_cache_path, eve
}
}
// Open cached hash file after copying to temp directory
// Updated 2022-03-07
// Updated 2022-03-09
exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, host_file_temp_path, filename}) {
console.log('*** Electron framework export: open_hash_file_to_temp() ***');
console.log('Open cached hash file after copying to temp directory');
@@ -149,6 +171,40 @@ exports.open_hash_file_to_temp = async function ({host_file_cache_path, hash, ho
}
// Open local file
// Updated 2022-03-10
exports.open_local_file = async function ({local_file_path, filename}) {
console.log('*** Electron framework export: open_local_file() ***');
console.log('Open local file');
console.log(`Local File Path: ${local_file_path}; Filename: ${filename}`);
// let full_local_file_path = path.join(local_file_path, filename);
// console.log(full_local_file_path);
// if (fs.existsSync(full_local_file_path)) {
// console.log(`Local file exists: ${full_local_file_path}`);
// // return true;
// } else {
// return false;
// }
let open_local_file_result = await ipcRenderer.invoke('open_local_file', local_file_path, filename).then((result) => {
console.log('IPC open local file finished');
console.log(result);
return true;
})
console.log(open_local_file_result);
console.log('End: open_local_file()');
if (open_local_file_result) {
console.log('File opened successfully');
return true;
} else {
console.log('File was not opened successfully');
return false;
}
}

View File

@@ -0,0 +1 @@
launcher reset

1
app/static/test.txt Normal file
View File

@@ -0,0 +1 @@
test txt