3 Replies Latest reply: Jan 9, 2013 7:58 AM by sinious RSS

    How to find Root directory?

    sivacse24rep Community Member

      Hi,

      I want to know answer for Two questions:

       

      Question 1:

       

      When i try to install my air package it show "c:\program files\samp". Due to some security reason i am not able to create or download a file under "c:\program files\" (under this page i made details discussion about this "http://forums.adobe.com/message/4973737#4973737"). To over come this problem i wan to install the air on "c:\samp" directly. How to do this?

       

      Question 2:

       

      If Question 1 is not possible then i want to workout this idea.My application will be installed on "c:\program files\samp" and i will move to root drive there i want to download the file (c:\samp\test.xml). From there i will access the file. Now my question is how can i find the root dirve of the installed application?

       

      if i installed the application on "C:\program files\samp" then my root drive should be C:\

      if i installed the application on "D:\program files\samp" then my root drive should be D:\ how to get this?

       

      Note:I am aware of File.getRootDirectories() but it give all root drive on my system.But i want to get the root drive of my installed path.

       

       

      Thanks,

      Siva

        • 1. Re: How to find Root directory?
          sinious CommunityMVP

          To be respectable to the users machine it's very common for an application to make a directory in the users Documents folder for the application while storing that users files in there. Adobe does this, for example. That could be an ideal route that shouldn't give you any permission issues. (File.documentsDirectory)

          • 2. Re: How to find Root directory?
            sivacse24rep Community Member

            thanks for the replay. But when i spit the files, i have Security Sandbox Violation  error (http://forums.adobe.com/message/4979534#4979534) thats the reason i want to have both the files on same path? how to overcome the issue?

             

            or is there any possible that by default my air package can install on c:\test\ insted of c:\program files\test?

            • 3. Re: How to find Root directory?
              sinious CommunityMVP

              Sounds like your issues go beyond AIR, such as perhaps a SWF you're loading with some sandbox settings set to network rather than local filesystem. Even at that, an AIR app isn't in a traditional sandbox like a SWF is. After the user permits it to run it has the power and permission to do whatever the user who ran it can. If you can create a folder, so can AIR. If you can delete a folder, so can AIR. I think your problem lies somewhere in between, like installing as administrator but running as a normal user without setting proper permissions. If an administrator owns the install folder and a regular user tries to edit it, it will fail, similar to what you see.

               

              c:\ is just bad symantics. There are just as many and sometimes even more permission obstacles on c:\ than c:\program files (x86). There isn't anything special about the program files folder. Nor should you have any issue at all writing to the users documents directory. That's the point of the path in the first place. A safe place to write anything the current user should want access to.

               

              You may want to specify any SWFs loaded via a loader with a context with these issues. Take a look at the code in this link where the context is set. The loaded content is loaded either into its own context, a child context or into the main applications context (giving full rights). You may want to load the SWF into the applications current context to be sure it has proper permissions rather than sandboxing it.

               

              http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf619ab-7ff0.html#WS2d b454920e96a9e51e63e3d11c0bf69084-7f03

               

              Pay special attention to the table/chart below the code. You should try setting context.applicationDomain = application.currentDomain; before loading your SWF. (Note: don't just paste that code in there without reading the link, it requires more code).