Skip to content

Commit

Permalink
search for app
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 committed May 13, 2024
1 parent 838a167 commit a4cc165
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
33 changes: 30 additions & 3 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,40 @@ const child_process = require('child_process');

let flaskProcess;

const path = require('path');
const fs = require('fs');

function searchForAppExe(directory) {
const files = fs.readdirSync(directory);

for (const file of files) {
const filePath = path.join(directory, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
const found = searchForAppExe(filePath);
if (found) {
return found; // Return the filepath if found
}
} else if (file === 'app.exe') {
return filePath; // Return the filepath if it matches 'app.exe'
}
}

return null; // Return null if 'app.exe' is not found in the directory or its subdirectories
}

// Function to start the Flask process
function startFlaskProcess() {
try {
// Attempt to spawn the process using the original path
let filepath = path.join(__dirname, '..', '..', '..', 'dist', 'app', 'app.exe');
if (!fs.existsSync(filepath)) {
filepath = path.join(__dirname, '..', 'dist', 'app', 'app.exe');
const filepath = searchForAppExe(path.join(__dirname, '..', '..', '..'));

if (filepath) {
console.log("Path to app.exe:", filepath);
} else {
console.error("app.exe file not found!");
process.exit(21);
}

flaskProcess = child_process.spawn(filepath);
Expand Down
12 changes: 6 additions & 6 deletions src/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function About() {
name: "Jonas Gabriel",
linkedin: "https://www.linkedin.com/in/jonas-gabriel-araujo/",
github: "https://github.com/jonasgabriel18",
photo: "../../assets/jonas.jpg",
photo: "../../../assets/jonas.jpg",
},

{
Expand All @@ -22,35 +22,35 @@ export default function About() {
name: "Bertrand Lira",
linkedin: "https://www.linkedin.com/in/bertrand-lira-veloso-52aa4926a/",
github: "https://github.com/BertrandLira",
photo: "../assets/bertrand.jpg",
photo: "../../../assets/bertrand.jpg",
},

{
name: "Cameron Maloney",
linkedin: "https://www.linkedin.com/in/cameronmal/",
github: "https://github.com/cmaloney111",
photo: "assets/cameron.jpg",
photo: "../../../assets/cameron.jpg",
},

{
name: "Gisele Silva",
linkedin: "https://www.linkedin.com/in/gisele-silva-6692941a4/",
github: "https://github.com/GiseleBr678",
photo: "../build/assets/LINDADEMAIS/gisele.jpg",
photo: "../../../assets/LINDADEMAIS/gisele.jpg",
},

{
name: "Thauã Magalhães",
linkedin: "https://www.linkedin.com/in/thaua-lucas/",
github: "https://github.com/tahaluh",
photo: "../../../../assets/thaua.jpg",
photo: "../../../assets/thaua.jpg",
},

{
name: "Thiago Rodrigues",
linkedin: "https://www.linkedin.com/in/thiago-rodrigues-b8a328249/",
github: "https://github.com/tahaluh",
photo: "thiago.jpg",
photo: "../../../assets/thiago.jpg",
},
];

Expand Down

0 comments on commit a4cc165

Please sign in to comment.