Reputation: 333
I have a .desktop file and I want to read the icon png image file path in javascript so I can display it in my html file. How would I go about doing this?
This is what my .desktop file looks like:
[Desktop Entry]
Version=1.0
Name=BackMeUp
Comment=Back up your data with one click
Exec=/home/alex/Documents/backup.sh
Icon=/home/alex/Pictures/backup.png
Terminal=false
Type=Application
Categories=Utility;Application;
Any help would be greatly appreciated!
Upvotes: 0
Views: 336
Reputation: 179
If the javascript
you saying is only the javascript in browser, it's impossible except you upload the file to a server and analyze it.
First of all you should have a form
that you can upload your .desktop
file, and then you upload to a server(you can use node.js
to build a server).
After the server received it, you can read its content as text and find the line of Icon
and then response to browser
if you can use node.js
for reading this file, it's much easier.
just install node.js
and build a .js
file and use fs.readFileSync
to read the .desktop
file and analyze it line by line.
Upvotes: 2