Download

Check if file or folder is Hidden

Hey, looking at IFileManager, I see there is a IsReadOnly function, I was wondering if there is anything similar to check if a specific file has the ‘hidden’ attribute?
I am making a simple in-game file browser using c++ and blueprints, but it lists all system/hidden files and folders, which I’d ideally like to avoid.

I’m not experienced in C++, so I was hoping there would be a simple check like the IsReadOnly :stuck_out_tongue: but there doesn’t seem to be

It looks like there is nothing for that, you have to write your own. Also it’s platform specific.

For windows:

Also on GNU linux all hidden files begin with a dot.

No idea about Mac.

Thanks for the tip Azarus. After looking more at how IsReadOnly works and at your link, I’ve got it working in an actor class as below:


bool ACheckHiddenCBA::CheckFile(FString FilePath)
{
	bool IsHidden = false;

		uint32 Result = GetFileAttributes(*FilePath);
		if (Result != 0xFFFFFFFF)
		{
			IsHidden = !!(Result & FILE_ATTRIBUTE_HIDDEN);
			return IsHidden;
		}
		else
		{
			return false;
		}
}

I had wanted it to create a custom blueprint node for it, but it seems blueprints don’t support uint32.