You are not logged in.

#1 2022-11-06 17:47:39

mamograg17
Member
From: Kingdom of Morocco
Registered: 2022-02-08
Posts: 40

can't load images from /usr/share/app-info/icons/ directory

i code an application that needs to get some pictures from /usr/share/app-info/icons/, but whenver i run the application, it is not working, it says  "can't load file no such file or directory". 1 week ago i can load them perfectly, i think the upadtes i did are responsible about it. the problem is that i did like 3 big updates.

any idea.

Offline

#2 2022-11-06 18:29:54

dogknowsnx
Member
Registered: 2021-04-12
Posts: 648

Re: can't load images from /usr/share/app-info/icons/ directory

Do you have 'archlinux-appstream-data' installed?


RI - Rest your Eyes and Self

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#3 2022-11-06 18:41:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: can't load images from /usr/share/app-info/icons/ directory

mamograg17 wrote:

i code an application that needs to get some pictures from /usr/share/app-info/icons/

Where is the code?  What language is it in?  What libs / dependencies are you using? How does it "get some pictures"?  Are you relying on some library, or opening files directly?  What is the "it" that gives that error message?  If it's your code, you'd know exactly where that error message came from and what's wrong.  Really, you need to tell us *something* about what's going on.

Last edited by Trilby (2022-11-06 18:41:59)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2022-11-06 19:30:33

mamograg17
Member
From: Kingdom of Morocco
Registered: 2022-02-08
Posts: 40

Re: can't load images from /usr/share/app-info/icons/ directory

dogknowsnx wrote:

Do you have 'archlinux-appstream-data' installed?

Yes.

Trilby wrote:

Where is the code?  What language is it in?  What libs / dependencies are you using? How does it "get some pictures"?  Are you relying on some library, or opening files directly?

I am using C++, wxWidgets library.
I am coding a gui package manager, and I need to get pictures from /use/share/app-info/icons/ .
The picture that i need varies from time to time, because the user is who is choosing what application he want to search for. So i made a function that searchs tjat directory for a picture of application that he wants, and the function works well without problems, it returns the full path that i want. The problem now is that when i run the executable. An window appears saying "can't load /usr/share/app-info/icons/*/*/*.png no such file or directory."
I am 100% sure that it exists cause i have archlinux-appstream-data installed and i cam browse the images from Dolphin.

Offline

#5 2022-11-06 19:47:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: can't load images from /usr/share/app-info/icons/ directory

Okay, so you ignored almost everything in my post.

What is the "it" that returns that error message?  Does the error message actually include those asterisks?  What do you do with the file name that your function (that "works well") returns?

Seriously, if you want help fixing your code, show the code.

Last edited by Trilby (2022-11-06 19:49:29)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2022-11-06 20:10:18

mamograg17
Member
From: Kingdom of Morocco
Registered: 2022-02-08
Posts: 40

Re: can't load images from /usr/share/app-info/icons/ directory

Trilby wrote:

Okay, so you ignored almost everything in my post.

What is the "it" that returns that error message?  Does the error message actually include those asterisks?  What do you do with the file name that your function (that "works well") returns?

Seriously, if you want help fixing your code, show the code.

"it" is a window that appears, i think it is GTK error window, this is what it says:

21:01:33: can't open file '/usr/share/app-info/icons/archlinux-arch-community/128x128/virt-manager_virt-manager.png
' (error 2: No such file or directory)
21:01:33: Failed to load image from file "/usr/share/app-info/icons/archlinux-arch-community/128x128/virt-manager_virt-manager.png
".
Trilby wrote:

What do you do with the file name that your function (that "works well") returns?

i put it in a variable, then i make a wxStaticBitmap, and i show this Bitmap on window.

this is the code:

//name variable is from the user
path = data.getApplicationImagePath(name);

std::cout << "path is:" << path<< std::endl; //this line always outputs a valid image path
wxBitmap image;
image.LoadFile(path,wxBITMAP_TYPE_ANY); //i tried wxBITMAP_TYPE_PNG as well
applicationImage = new wxStaticBitmap(this,-1,image);

the cout outputs this:
path is:/usr/share/app-info/icons/archlinux-arch-community/128x128/virt-manager_virt-manager.png

but this other error is logged, i don't know what is it:
Unhandled unknown exception; terminating the application

Last edited by mamograg17 (2022-11-06 20:11:18)

Offline

#7 2022-11-06 21:05:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,523
Website

Re: can't load images from /usr/share/app-info/icons/ directory

And this is why exact error messages matter*: your "path" variable includes a newline at the end and there are no image files provided by the above-mentioned package that include a newline at the end.  Their names end in ".png" not ".png\n".

The error message is from wxwidgets, specifically the image widget as you are in fact giving it a bad file name just as it indicates.

*or the full code, not the part that you think is relevant.

Last edited by Trilby (2022-11-06 21:08:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2022-11-06 21:28:50

seth
Member
Registered: 2012-09-03
Posts: 51,017

Re: can't load images from /usr/share/app-info/icons/ directory

Edit: missed the newline…

Last edited by seth (2022-11-06 21:29:26)

Offline

#9 2022-11-08 12:01:56

mamograg17
Member
From: Kingdom of Morocco
Registered: 2022-02-08
Posts: 40

Re: can't load images from /usr/share/app-info/icons/ directory

Trilby wrote:

And this is why exact error messages matter*: your "path" variable includes a newline at the end and there are no image files provided by the above-mentioned package that include a newline at the end.  Their names end in ".png" not ".png\n".

The error message is from wxwidgets, specifically the image widget as you are in fact giving it a bad file name just as it indicates.

*or the full code, not the part that you think is relevant.

Thank you,

that was the problem. i fixed it now.

Offline

Board footer

Powered by FluxBB