Skip to main content

Timeline for How to get file paths in XNA 4.0?

Current License: CC BY-SA 3.0

14 events
when toggle format what by license comment
Jun 5, 2012 at 8:35 vote accept NDraskovic
S Apr 27, 2012 at 16:35 history suggested CommunityBot CC BY-SA 3.0
Title which states the problem and not a possible solution.
Apr 27, 2012 at 16:13 review Suggested edits
S Apr 27, 2012 at 16:35
Apr 27, 2012 at 13:32 comment added NDraskovic I don't think you understand me - this file I use only provides informations on where and which objects will be drawn to the screen (that is one of the basic requirements for this application). Think of it as a very simplified level designer. I need to enable the user to write his design/configuration (call it what you want) in a naotepad or similar text editor and then pass the path of that file to my application so it can be drawn in a way he wanted
Apr 27, 2012 at 12:34 comment added Roy T. If relative paths didn't work you should reexamine them because they should work, also think again if it's a good idea to have your config file on the desktop and not in a subfolder of your program. Yet another solution would be to add an app.config file to your project and load data from it using ConfigurationManager.AppSettings (msdn.microsoft.com/en-us/library/…)
Apr 27, 2012 at 11:22 comment added NDraskovic This is not a problem, since this application is intended for educational purposes and will be developed only for PC-s (with windows OS). I've tried with relative paths, but then the modifications to the file do not manifest themselves (currently the file is located on my desktop, and the application works perfectly)
Apr 27, 2012 at 11:19 answer added Emir Lima timeline score: 6
Apr 27, 2012 at 11:09 comment added Toni Of course, this is a problem if you intend to deploy to xbox which does not support system.windows.forms namespace
Apr 27, 2012 at 10:57 comment added Toni Are you aware of relative paths? I think what you are describing is that you are using absolute file system path to access a file located in your application's folder when you could just access it for example ".\myfile" or just "myfile". Besides that, yes, .net has OpenFileDialog class and you could use it to allow user select a file...
Apr 27, 2012 at 10:29 comment added NDraskovic I know about the XML approach but I can't use it because the application will be used on multiple computers (that is the root of the problem) so I need to be able to change the data after building
Apr 27, 2012 at 10:26 comment added Roy T. You can put the information in an XML file, have it build as content and then load it in game the same you load textures and models. Only problem is that you can't change it then without rebuilding. You can also give it the path relative from your .exe (on PC) using a new Uri(...) with the Relative option set.
Apr 27, 2012 at 10:19 comment added NDraskovic No I haven't, thanks for the link, I'll take a look when I get the time.
Apr 27, 2012 at 10:15 comment added George Duckett Have you seen the XNA with WinForms examples on the App Hub? Links are in this answer: stackoverflow.com/a/6558501/593627
Apr 27, 2012 at 10:10 history asked NDraskovic CC BY-SA 3.0