Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding files that aren't local #19

Open
GameEnjoyer007 opened this issue Mar 26, 2024 · 17 comments
Open

Adding files that aren't local #19

GameEnjoyer007 opened this issue Mar 26, 2024 · 17 comments
Labels
question Further information is requested

Comments

@GameEnjoyer007
Copy link

Hello,

I hope this message finds you well. I apologize if this isn't the appropriate channel for communication, but I couldn't find any other means to contact you directly.

Firstly, I wanted to extend my sincere gratitude for providing your Godot project. It has been immensely helpful for a personal project of mine, particularly as I'm creating a birthday gift for my brother (April 7th).

I must admit, I'm not a professional when it comes to Godot, GitHub, or programming in general. However, I've been exploring your project and I had a question I was hoping you could assist me with.

Is there a way to ensure that specific files, ones I specify, are included with the game when it's downloaded and played on another computer? Specifically, I'm interested in ensuring that any pc who plays the game will have access to certain files. The code I'm referring to (i think) is desktop_file_manager.gd.

Any guidance or assistance you could provide would be immensely appreciated.

Thank you once again for your contribution and for any help you can offer.

Best regards,
Markus

@popcar2
Copy link
Owner

popcar2 commented Mar 26, 2024

Hi Markus,

What files do you want to add? If it's a file type GodotOS supports, you can add them to the Default Files folder, then add a line in desktop_file_manager.gd like you said

copy_from_res("res://Default Files/[File Name]", "user://files/[File Name]")

Note that you'll have to delete your GodotOS folder every time to test this, it only generates the files if the user:// folder doesn't exist (which should be in AppData/Roaming for Windows I think)

Let me know if you need more help

@GameEnjoyer007
Copy link
Author

Thank you so much for getting back to me promptly.

I'm looking to add a custom "app" to the project, which, when clicked, would open a Chat Messenger in GodotOS. Essentially, it would be a file that triggers a window to open, which I can design within Godot.

If there's any further guidance you can provide on how to implement this, I'd greatly appreciate it.

Thanks again for your assistance.

Best regards,
Markus

@popcar2
Copy link
Owner

popcar2 commented Mar 26, 2024

Unfortunately creating a file might be a bit difficult since you'd need to create a new file type. The easiest way to implement it right now is by adding a new button to the start menu and pointing it to a Godot scene you have in the project, you can look at the current games as an example.

Keep in mind you can't embed real apps into GodotOS sadly, you'll have to make your own chat messenger app as its own scene inside of Godot. That would be a bit technical and you may need help from a Godot programmer. Once you created a scene though, just duplicate a start menu button then point it to that scene you made and it should open in a separate window.

@popcar2 popcar2 added the question Further information is requested label Mar 26, 2024
@GameEnjoyer007
Copy link
Author

Thank you for the clarification. Indeed, what I'm aiming for is more of a simulated messenger, not a real one. It's all part of a larger puzzle my brother will have to solve for his birthday surprise.

Regarding your suggestion about creating a file to open the fake messenger window, I was wondering if it's feasible to write some code that connects a file to this action. Essentially, I'm thinking of a simple script that triggers the opening of the fake messenger window when executed. Would this be a viable approach?

Otherwise I will probably just make a button in the start menu, like you suggested.

@popcar2
Copy link
Owner

popcar2 commented Mar 26, 2024

Here's how to make a new file type if you'd like to give it a shot:

  • Add a new file_type_enum in desktop_folder.gd
  • Add functionality for that file type in the _ready() and spawn_widow() functions
  • Go to BaseFileManager.gd and add functionality for it in populate_file_manager(), which will spawn that file type if it sees a specific extension (it could be a fake extension like .chat)

I hope I didn't miss any steps but I think that should work. Now you just add that file into the default files folder and add it on the desktop.

@GameEnjoyer007
Copy link
Author

Thank you, I'll try that one right now.

@GameEnjoyer007
Copy link
Author

GameEnjoyer007 commented Mar 26, 2024

I've encountered an issue while trying to implement step 3 in the process you outlined. In BaseFileManager.gd, I received an error stating that the custom file extension "LOL_FILE" is not recognized in the "FakeFolder.file_type_enum".

I've already added "LOL_FILE" to the filetype_enum in desktop_folder.gd, as instructed. However, it seems there's still an issue. Do you have an idea how to fix that?

image
image

@popcar2
Copy link
Owner

popcar2 commented Mar 26, 2024

Try restarting Godot, it can sometimes have trouble with updating enums.

@GameEnjoyer007
Copy link
Author

Just a quick update to let you know that the issues have been resolved. Thank you for your assistance.

However, during testing, I encountered another problem. When I shared the game with a friend to verify if the files weren't local, not only did the specified files fail to appear, but my friend also encountered difficulties creating files or folders, or performing any actions within the game. Additionally, even when I sent him the AppData GodotOS folder containing all default files, the issue persisted.

I would guess, that the FileManager isn't able to do anything at all :( (I exported the project as a Windows Executable)

Any insights on how to address this would be greatly appreciated.

Thanks again for your help.

Best regards,
Markus

@GameEnjoyer007
Copy link
Author

GameEnjoyer007 commented Mar 26, 2024

For instance, your template works perfectly fine when shared. Every default file loads.

If it helps, here is the code of desktop_file_manager.gd I have in the modified version:

https://pastebin.com/raw/8BAFZjc3

@popcar2
Copy link
Owner

popcar2 commented Mar 27, 2024

Are you getting any errors? It could be that it couldn't find the files to copy. You might need to add the file extensions to this part of the export window to make sure it's included in the exported build:

image

@GameEnjoyer007
Copy link
Author

Yesterday, I struggled to persuade him to demonstrate the console to me. However, after following the steps depicted in the screenshot, my Windows system promptly flagged the file as a virus and deleted it.

@GameEnjoyer007
Copy link
Author

Even with the filters removed, since booting up my computer today, Windows consistently flags my export as a virus, leaving me baffled and confused.

@GameEnjoyer007
Copy link
Author

After disabling rcedit, which alters my export logo, the file is no longer flagged as a virus.

However, even with these adjustments, the issue persists. Additionally, attempts to create files and folders yield no results, despite deleting the GodotOS AppData folder.

@GameEnjoyer007
Copy link
Author

I would appreciate it if you could inform me of any settings adjustments that could potentially resolve the issue, if there are any.

image
image
image
image

@GameEnjoyer007
Copy link
Author

GameEnjoyer007 commented Mar 27, 2024

I'll attach a photo of the console, when running on a different pc.

image

alternatively, here is the error code on pastebin:

https://pastebin.com/raw/UjTryS4F

I'll see, if I can fix that myself, as I've not read it by now

@GameEnjoyer007
Copy link
Author

I managed to resolve the issue; it occurred because I updated the name of the folder icon but neglected to make the corresponding change in the sprite editor thingy. Quite embarrassing oversight on my part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants