Is it possible to change the file extension of a file which is located in my SpecialFolder > ApplicationData folder?
I create and save an image file there (myFile.png), and wish to rename it myFile.ico
Could someone please point me in the right direction?
First off you realize that just changing a file extension does not make the content of the file change… As in just changing to “.ICO” does not make in an ICO file.
and you use F.NAME=“new name” [check the LR for specifics)
If I rename favicon.png to favicon.ico via the OS - it works perfectly when I upload it to a server.
But when I try to save a file as favicon.ico in Xojo, the extension is missing off of the end of the file - therefore, I need to save it as favicon.png in the ApplicationData folder, and then try to rename it there.
Example - the code below works perfectly.
s.Execute("sips -s format png -Z 32 "+f1.shellpath+" --out " +f2.shellpath+"/favicon.png")
But the code below creates the file (missing the file extension)???
s.Execute("sips -s format png -Z 32 "+f1.shellpath+" --out " +f2.shellpath+"/favicon.ico")
No, this can be wrong, plainly wong. Dave S. states corectly: changing the file type does not change the file contents.
I know people who use cbr, cbz, rar, zip as file extension and most of the time, the file extension is <> of the file contents. In those cases, there is a file type tag inside the file data (at the begnning of the file data: “PK” for zip archives and “RAR” for RAR files. They says: when I click in the file, the proper application is running and extract the files from the archives. It works so it is the way to go. How wrong is that (and sad).
Emile - I never disagreed with Dave?
I simply said that if I manually change the file extension from .png to .ico - it works fine when I upload it (it displays as the favicon on my site).
I also tried the following code - but that also fails silently:
s.Execute("sips -s format ico -Z 32 "+f1.shellpath+" --out " +f2.shellpath+"/favicon.ico")
It seems sips cannot do this - therefore I asked how to change a file extension via regular Xojo code.
I’ve made an experience: Preview is not able to load .ico files (genuine ico files), but it loads my png (20 x 20) after I change its file extension to ico (instead of png). This is due to the check of the presence of the PNG tag inside the file.
I get an eye there: WikipediA and you may use .png as the file type and file extension. You have to check for the browser versions.
Try that and if it works as I feel, you do not have to change the file type.