Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions src/components/pages/FileManagementPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,38 +281,38 @@ export const FileManagementPage = () => {
};

// Open file
const handleOpenFile = async (file: FileData) => {
try {
// First save the file to a temporary location
if (!window.electron || !window.electron.saveFile || !window.electron.openFile) {
console.error("Electron API not available");
return;
}
// const handleOpenFile = async (file: FileData) => {
// try {
// // First save the file to a temporary location
// if (!window.electron || !window.electron.saveFile || !window.electron.openFile) {
// console.error("Electron API not available");
// return;
// }

// Save file to temp location and then open it
const saveResult = await window.electron.saveFile(
file.data,
file.name,
file.type || 'application/octet-stream'
);
// // Save file to temp location and then open it
// const saveResult = await window.electron.saveFile(
// file.data,
// file.name,
// file.type || 'application/octet-stream'
// );

if (!saveResult.success || !saveResult.filePath) {
if (!saveResult.canceled) {
console.error("Error saving file:", saveResult.error);
}
return;
}
// if (!saveResult.success || !saveResult.filePath) {
// if (!saveResult.canceled) {
// console.error("Error saving file:", saveResult.error);
// }
// return;
// }

// Now open the file with the default application
const openResult = await window.electron.openFile(saveResult.filePath);
// // Now open the file with the default application
// const openResult = await window.electron.openFile(saveResult.filePath);

if (!openResult.success) {
console.error("Error opening file:", openResult.error);
}
} catch (error) {
console.error("Error opening file:", error);
}
};
// if (!openResult.success) {
// console.error("Error opening file:", openResult.error);
// }
// } catch (error) {
// console.error("Error opening file:", error);
// }
// };

// Format file size
const formatFileSize = (bytes: number): string => {
Expand Down
Loading