How to make a download button godot - download

i've been working on a game in godot using gdscript. In this game I will need to download a txt file onto a user's computer at a click of a button so it can keep track of score. but when I make a file download it downloads into the source code what path should I make it.
code:
func _on_save_pressed():
var file = File.new()
file.open("save_data.txt", File.WRITE)
file.store_string(score)
file.close()
I have tried using /desktop and I would like this path to work for mac and windows.

Try file.open("user://save_data.txt", File.WRITE).
Documentation

Related

How can I download the large file from google drive using rclone?

Now I want to download the dataset on the website(http://pubchemqc.riken.jp/), it's in google drive and filesize is 2TB. the website recommend using rclone to download the file but not said how to use.
As the picture shows
This was asked a while back already but I'd like to keep it recorded here as it seems hard to find.
Unfortunately I don't know if there's a way to automate this process but it's still easy.
What you can do is create a new remote with the link's root_folder_id.
The Root Folder ID is present in the url e.g:
in the example link
https://drive.google.com/drive/folders/a1b2c3deFgHi4JKlm56nOpqrStuv7w8xy9
the root_folder_id is the string after the slash /folders/ so in this case it would be "a1b2c3deFgHi4JKlm56nOpqrStuv7w8xy9". If the Google Drive shared link you got is a folder all you have to do is copy that id and use it in the rclone's new remote setup. Now if the shared link points directly to a file, like the one in the OP, there's no folder to download it from, so we gotta create our own! The whole process would look like:
get the folder_id from Google Drive's link. If it is a link to a direct file then first we have to create a new folder anywhere inside our own Google Drive, it's name doesn't matter as we will point directly to it using the ID. After creating this new folder, open it and note the url, it should look something like
https://drive.google.com/drive/u/1/folders/Fdrcv3nQvxQqXUGEEyvacwUxdYXpV33Ct
just copy everything after /folders/ and save it for later.
now go back to the link of the direct file. Add a shortcut for that file to inside your recently created folder, so say the folder was named dl-with-rclone, click the "Add shortcut to Drive" icon and navigate to the "dl-with-rclone" folder to add the shortcut there.
heading to rclone, do:
rclone config <to open settings>
On the prompt e/n/d/r/c/s/q> hit n (the key relative to creating a new remote)
On name> give it a name like sharedWithMe or anything else for personal reference later
On the prompt Storage>, the possible remotes to connect to, write down drive or the number relative to it (currently 15)
if you set up your own client_id and client_secret you put them next
On the scope> prompt option 2 "Read-only" is enough
now this is the important one:
on the root_folder_id> prompt input the ID of the folder of the shared link or the folder you created and pointed the file shortcut to, e.g. Fdrcv3nQvxQqXUGEEyvacwUxdYXpV33Ct
Now you can pretty much hit enter for everything, once you reach Use auto config? you will be redirected for a browser to login. Make sure the logged in account is the same that you created the folder for the shortcut. If the shared link is for a folder already your logged in account doesn't matter.
After finishing your remote setup you can exit rclone config
The command you would need would be something like rclone copy sharedWithMe: destination/folder
This being rclone you would surely be able to copy from one remote to another, that's up to the user.
In summary: I did test this method on your link, creating a folder in my Drive, pointing the file shortcut to it and using the root_folder_id to setup the rclone remote and it did begin to download:
rclone test download screenshot

How to get original image paths within iphotos library mac swift

I am trying to get original file path of images from photos library. By using NSOpenPAnel i am able to get the photos library path i.e file:///Users/betteruse/Pictures/Photos%20Library.photoslibrary
I want to traverse the file and retrive the contents in Master folder. I am doing it in swift and stuck at this point. Please help me with this.
don't know what's swift but via finder u can right click on library file and open it as a package , u can make an alias of Masters, orbu can get it via terminal also with simple and usual cmds as cd and ls.

Code Composer Studio - TI CC3200 Launchpad

How can I upload the example "blinky" to the TI CC3200 Launchpad "firmware"?
I mean, I would like to plug in the board and the blinky example starts automatically on the startup of the board.
Thank in advance
You have to flash the flashmemory on the launchpad with a flashtool like CCS UniFlash.
Download CCS UniFlash. Once you're done with that, launch it and choose new target configuration. You will have an option on the left side that lets you choose the local url to your bin (or in this case, blinky bin file, which is typically in your SDK folder). Once you're done with that, you should be able to program it via the program button.
The correct and complete method is to follow the procedure mentioned here.
Note that you have to press on the file "/sys/mcuimg.bin" under "System Files", for the contents of the image displayed on the website to be shown.
Just want to add few lines on top of above answer.
1) When you build you project in CCS it will create .bin file in release folder of your project directory which you will flash in cc3200.
2) While doing so make sure cc3200 is in programmed mode.(SOP2 Jumper is on).
3) After you successfully flashed the .bin just remove the SOP2 and press reset.
Cheers !

How to generate a tiff/box file from an image to train Tesseract in Windows

I'm trying to train Tesseract in Windows and for that I need a pair tiff/box file and I'm trying to create it using jTessBoxEditor but it doesn't accept images as input. I've also tried boxFactory but it doesn't run properly. Does anyone know what is the best tool to create the pair from images?
Thanks
If you have jTessBoxEditor, then you have Tesseract bin files. Go to the tesseract-ocr subfolder of jTessBoxEditor and run the following command :
tesseract.exe D:\testocr\TestImage.tif D:\testocr\TestImage batch.nochop makebox
It should generate the file D:\testocr\TestImage.box.
Then in jTessBoxEditor, go to Box Editor tab and open your image. The box file is automatically loaded, you can check if everything is ok and correct possible mistakes.
I had this same kind of problem with being unable to properly open images with jTessBoxEditor in order to work with their boxes. I realized that one essential component is that the name of the .tif image and the name of the .box file must be identical, except for the different extensions. Without this, jTessBoxEditor won't be able to know which box file goes with which image. Thus, using the syntax suggested by darkpotpot above, then making sure the two file names match like indicated, then clicking on the "open" button in the Box Editor tab of jTessBoxEditor should work.

Creating Dropbox like DMG package

Does anyone suggest a freeware tool/script/manual_way of creating Dropbox like DMG -
Need to ask couple of questions --
I want double clicking the Folder-Icon should copy the folder(which would contain installer and uninstaller .app files of my application) into the system's /Applications folder.
Solution -- This has been solved using Applescript and changing icon of that applescript file to the folder-icon(i.e double clicking that script will move our folder(which would be present in a hidden folder) to /Applications.Any suggestions for second and third part?
Is it possible to show hyperlink of actual dropbox.com to actually open it's website?
And how we can customize volume's/Drive icon?
You can find a way to do it by reading this: Packaging a Mac OS X Application Using a DMG ยป asmaloney.com
I believe you can also use the trick of naming a shellscript file something.command in order to make it double clickable, (but maybe it will open the terminal, -I haven't tried it).

Resources