Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Standalone builds using DirectoryInfo not working across Windows 7 and 8 platforms.

Discussion in 'Editor & General Support' started by Stormrune, Jul 24, 2014.

  1. Stormrune

    Stormrune

    Joined:
    Jul 24, 2014
    Posts:
    1
    I have an app that needs to scan a Resources dir for files (there are a few hundred that get changed occasionally so a scan makes sense). I use a DirectoryInfo instance then scan it it using GetFiles. I need this to run on Windows 7 and on 8.1 with both a laptop and a Surface Pro. However, I can't get the same standalone to work on all three regardless of which platform I build it on, although it does always work on the platform it was built on. All platforms have all of the latest Windows updates. Note that this problem occurs regardless as to whether I make a 32 bit or a 64 bit build.

    If I build the Windows standalone on my Windows 7 desktop, it works fine on Windows 7 but on my Windows 8.1 Surface Pro 3 and Windows 8.1 laptop it DirectoryInfo cannot find the directory (it returns dirInfo.Exists == false), causing the GetFiles query to throw an exception.

    If I build the app on a Windows 8.1 Laptop it works on the Laptop but not the surface.

    If I build the app of the Surface Pro 3 it works fine on the Surface and the Windows 7 desktop but not on the Windows 8 laptop.

    Fortunately I currently have access to multiple licenses to do this testing.

    I would like for a single build to work on all 3 devices. Has anyone run into this or have an idea what is happening here?
     

    Attached Files:

  2. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Assets/Resources will only exist on the machine where the editor runs. When you make a standalone build, that folder isn't copied into the Data folder that the standalone uses. Making a build causes the contents of Assets/Resources to be compiled into something you can think of as being like a zip file. The run-time code knows how to consume that file and mine assets out of it. If the contents are changing, then you'll need to change them on the Surface Pro, for example, and have them live in a folder that you know in advance.