Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I get documents filepath?


As the title says, I'd like to get the documents filepath, and then get files from documents(text files) with FFileManagerGeneric::FindFiles(). I tried looking at FPaths, but I couldn't find anything.

Any ideas on how I should do this?

Product Version: Not Selected
more ▼

asked Feb 20 '15 at 09:16 PM in C++ Programming

avatar image

82 24 24 29

avatar image amigo Feb 20 '15 at 11:46 PM


You aren't really clear on what documents file path are you looking for?

For example you could get directory where projects are with:

const TCHAR* FGenericPlatformProcess::UserDir()

Or are you looking to just browse the file system anywhere (this could be a problem depending on the system permissions, so needs to accounted for)?

Perhaps the problem you had with FFileManagerGeneric was that of relative vs absolute path?

You are probably best of working with relative paths (relative to the Engine root) so that your code works on all platforms.

avatar image Wrekk Feb 21 '15 at 03:41 PM

I just wanted to have some files in My Documents that I would load at runtime.

avatar image amigo Feb 21 '15 at 03:51 PM

Then use UserDir() method to get the right path to it.

avatar image Wrekk Feb 21 '15 at 06:25 PM

Hm, FGenericPlatformProcess::UserDir() seems to lead to "C:/Program Files/Epic Games/4.6/" (this is what I get http://gyazo.com/e26e475d1890b6a87f6daaf2e9918bea ).

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I think that should've been FPlatformProcess::UserDir() instead - sorry about that.

more ▼

answered Feb 21 '15 at 11:49 PM

avatar image

1.1k 53 33 90

avatar image Wrekk Feb 22 '15 at 02:36 AM

It works! Thanks for the help man, I really appreciate it. :)

EDIT: One more question, do you have any idea how to load .png files into a UTexture array (from My Documents as well)?

avatar image amigo Feb 22 '15 at 04:06 AM
avatar image Wrekk Feb 22 '15 at 11:50 AM

Hm, I can't seem to find out how to get a .png loaded as a UTexture. :(

I tried to use some of those examples, but with no luck.

avatar image amigo Feb 22 '15 at 03:44 PM

Did you check the second link to the answer I linked above?

It has a code snippet by Dune that loads a UTexture2D by specifying a path to it. That should work, but beware of the caveat mentioned in there as well regarding cooking content.

avatar image Wrekk Feb 22 '15 at 03:48 PM

Are you sure that you can load .png files from My Documents with that code? I tried it and it didn't seem to work. :(

avatar image amigo Feb 22 '15 at 03:58 PM

It might be an issue with relative vs full paths, but to be honest I am not sure whether arbitrary loading from any folder is allowed. Although you are loading from UserDir() value, so it should work.

Take a look for example at SpeedTree importer, they are loading textures and seem to have some path conversions: Engine/Plugins/Editor/SpeedTreeImporter/Source/SpeedTreeImporter/Private/SpeedTreeImportFactory.cpp

avatar image Wrekk Feb 22 '15 at 04:03 PM

I'm not currently subscribed to UE (I'll resub when 4.7 is out), and I don't have the source at the moment. Any chance you could show me the code? :)

avatar image amigo Feb 22 '15 at 04:49 PM

We are only allowed posting a limited number of lines for discussion, and I think you need to take a look a the whole of the Import Factory to get the scope of it.

If you have old code from when you were subscribed, you could probably look at other parts of the engine, where levels or materials are loaded, they must use the same methods.

avatar image Wrekk Feb 22 '15 at 04:52 PM

Alright, I'll do that. Thanks. :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question