Godot - Loading a Saved Game - game-development

I am trying to create a C# script to save and load the saved games in Godot. I have organized the information of each node (each node that will be saved) in a dictionary (one dictionary is created for each node that will saved) and all the information is saved in a txt document with a format like “gamesaved.txt”.
The system is saving the information without problem in the Project Data folder. The problem is that when I want to load the game saved, Godot appears to have problems to open the File. I use something like this in my “load method”:
saveGame.Open("user://savegame.text", File.ModeFlags.ReadWrite)
and in the next line I use
While (saveGame.GetPosition() < saveGame.GetLen())
to start to read the file and use the information of the dictionaries but system says ERROR!` And says:
“get_position: File must be opened before use”
It appears that the system doesn’t recognize that the File has been opened in the previous line with saveGame.Open()
Do you have any idea what the open method could not be working?

Related

Excel on Mac. Cannot open IQY file in Data/Get External Data/Run Web Query

I am running Excel version 16.45 on Mac.
I have created a .iqy and saved it in the Queries directory alongside certain templates which were already there.
I go to Data/Get External Data/Run Web Queries. While the templates are accessible, my file is visible but greyed out (same thing happens if I save the file in a different directory).
Would anyone be able to help?
According to your information, I would like to confirm whether the issue occurs when you follow the steps as below:
1.Create a Word file, paste the web URL.
2.Save the Word as .iqy with .txt format.
3.Choose MS-DOS as coding.
4.Create an Excel file and click "Data >Get External Data >Run Web Query (Or Run Saved Query) " of the Bar
I was able to address the issue as follows.
When navigating to the relevant directory with Finder, the '.iqy' file appears to be appropriately named (as per Image 1).
In fact, if you reach the file in Terminal, the file is saved as '.iqy.txt'.
So all I had to do is rename the file, simply removing the '.txt' string at the end.
Screen you see when navigating in Finder

Domain=NSCocoaErrorDomain Code=513 only when rename folder through UITests target for UI Autoamtion

I am developing a product like DropBox and Box application, and I need to verify Rename/Add/Delete I/O operation using automation.
I am writing UI Automation Test Cases using XCUITest in Xcode.
In that I need to use I/O operation for rename file/folder but It gives the below error while using moveItemAtPath function to rename folder:
Error Domain=NSCocoaErrorDomain Code=513 "“Folder” couldn’t be moved because you don’t have permission to access “Folder1”." UserInfo={NSSourceFilePathErrorKey=*path, NSUserStringVariant=(
Move), NSDestinationFilePath=*destiPath, NSFilePath=*path, NSUnderlyingError=0x6000002507d0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Its working fine when running the app in main target and also its working in UnitTest target but its not working while running UITest automation target.
NOTE: App Groups are also enabled.
Any help is appreciated!
Try changing the folder you writing to or in your case i dont know why you're renaming the folder. If you've to do something to your folder then perhaps having that folder in one of these locations Documents, Temp and Cache. Most likely, you will want to write to the Documents folder.
It seems to me like a codesign error. Refer this post NSFileManager creating folder (Cocoa error 513.)
Try this below approach. I'm quoting apple documentation - https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW22
Scenario 1:
Your app needs to be able to save a file with a different extension than that of the original file. For example, when you paste an image into an RTF file in TextEdit and save it, TextEdit changes the file’s extension from .rtf to .rtfd (and it becomes a directory).
To handle this situation, you must use an NSFileCoordinator object to coordinate access to the file. Before you rename the file, call the itemAtURL:willMoveToURL: method. After you rename the file, call the itemAtURL:didMoveToURL: method.
Scenario 2:
Your app needs to be able to open or save multiple related files with the same name and different extensions (for example, to automatically open a subtitle file with the same name as a movie file, or to allow for a SQLite journal file).
To gain access to that secondary file, create a class that conforms to the NSFilePresenter protocol. This object should provide the main file’s URL as its primaryPresentedItemURL property, and should provide the secondary file’s URL as its presentedItemURL property.
After the user opens the main file, your file presenter object should call the addFilePresenter: class method on the NSFileCoordinator class to register itself.
In both scenarios, you must make a small change to the application’s Info.plist file. Your app should already declare a Document Types (CFBundleDocumentTypes) array that declares the file types your app can open.
For each file type dictionary in that array, if that file type should be treated as a potentially related type for open and save purposes, add the key NSIsRelatedItemType with a boolean value of YES.
To learn more about file presenters and file coordinators, read File System Programming Guide.

How can I upload a whole folder of PDF files, So that I can skim through each file without having to upload each one of them individually

I have a folder of PDF files, what I want to do is build a small app with directional arrows that when pressed should upload the next PDF file from the uploaded/Selected folder.
I have tried uploading single PDF and I was able to view it, but I'm unable to find any good resource on how to upload a whole directory inside the application for me to not upload each PDF every single time.
I should be able to change my current opened PDF to the next one inside the folder.
The way to do this in Vue is as follows:
Make a input field and attach the event "v-on:input" with the function that will be called when the input is selected.
Don't forget to add "webkitdirectory mozdirectory" for firefox and chrome browsers.
Inside the function fetch the input query via "document.querySelectorAll('input');". The information of files will be inside files object.

errors when opening file - it is opening as read only

Having a few issues when opening an external excel file.
Basically we have a system where we use a template excel file that writes to another excel workbook. (Multiple users could be in a template file at any one time)
The code is pretty straight forward in that it opens the file as readonly when extracting information and it opens the file as normal when adding/updating new information.
An issue has arose though with 1 particular user - when they click the button to update it always opens the file as read only (doesn't happen to anyone else) I have tried putting her on a different PC and it worked fine - so I am thinking it must be something to do with her settings on our system.
As anyone else come across this or any ideas how to resolve? (Done a office repair but didn't help)
Thanks

VB.NET Opening A File From Form

I'm using the following the code to open a file that resides elsewhere on the computer:
System.Diagnostics.Process.Start(PathToOpen)
Where PathToOpen is the full address to the file I wish to open. This appears to work as intended for any file type that has an application installed that can open the file.
Whilst this works OK, if the file is on a networked drive, I want my VB.Net code to check if the file is currently in use, if so display a message. Currently what happens is if a second user tries to open the file, it opens read-only (a word file for example) which is handled outside of my application. I want to intercept before the file is opened and stop the process there.
Is this possible at all?
You are basically asking if it's possible to monitor files on a system that doesn't even belong to you ?
Word does know about a file already in use because it creates a hidden file next to the one you open. if there is already a hidden file, it means the file is already in use.
Other applications use different ways of knowing if a file they can use is already opened somewhere else.
In order to do what you want to do, you need to know how all the applications handle this problem...
A possible solution would be for you to create a small hidden file next to the file the user wants to open (just like MS Word does). Only problem, you need to destroy the file when it's closed by the user, and you have no way of knowing that...