gluon-framework / gluon

A new framework for creating desktop apps from websites, using system installed browsers and NodeJS
https://gluonjs.org
MIT License
3.1k stars 76 forks source link

Change behavior of deno branch to create 'gluon_data/chrome' in current directory #59

Closed yangiYA closed 1 year ago

yangiYA commented 1 year ago

When running the compiled exe of the deno branch, it creates 'gluon_data/chrome' in the physical path of the developer's project. This behavior is inconvenient when distributing the exe to third parties.

After reviewing the implementation in 'gluon/src/index.js', it was found that the browser's temporary directory is created using fileURLToPath(import.meta.url) and files are placed there. import.meta.url contains the physical path of the project at compile time in the compiled exe. Therefore, the behavior is determined by where the developer clones the gluon project.

I would like to request that 'gluon_data/chrome' be created in the current directory instead.

Here are relevant lines from 'gluon/src/index.js' :

(Line 17)
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

(Line 147)
const ranJsDir = !Deno.args[0] ? __dirname : (Deno.args[0].endsWith('.js') ? dirname(Deno.args[0]) : Deno.args[0]);
const getDataPath = browser => join(ranJsDir, 'gluon_data', browser);

Thank you for your attention to this issue.

CanadaHonk commented 1 year ago

Thanks for the report and PR (merged), sorry for the wait. Deno branch has kind of been left but I plan to integrate it into main soon (this month likely).