• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Andrew_Solesbury · Sep 12, 2013 at 06:21 PM · errorwindowsfileaccess

Access is denied in Windows 8 App

I am creating a Windows Store App that allows you to write and edit basic text files with the extension .note. I have written a basic script which works fine in previews, but simply wont work when I run as a Windows 8 app. The code below is raising an Access to path is denied error in the debug. (snippet from the full script)

 var MyDocsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
 path = MyDocsPath+"/TakeNote/Notes/";
 Debug.Log(path);
 
 if (!Directory.Exists(path)){
     
     Debug.Log("Directory does not exist");
     Directory.CreateDirectory(path);
 }else{
     Debug.Log("Directory exists");
 }

I think that this code is correct (because it works in previews) and that my issue is with giving the app the correct permissions on the system, but I can't seem to find where you can add file access permission in unity or in visual studio express.

Any help would be greatly appreciated.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ArkaneX · Sep 12, 2013 at 08:13 PM 0
Share

I wonder how you compiled it. Environment.GetFolderPath, Environment.SpecialFolder and Directory class are not supported in Windows Store applications. At least according to official Unity Windows Store FAQ.

If you open first link and go to System.IO namespace, you won't see Dictionary there. If you go to System namespace, you will see Environment class, but only the members marked with green suitcase icon (or whatever it is...) work in Windows Store apps.

avatar image Andrew_Solesbury · Sep 13, 2013 at 06:06 PM 0
Share

Ahh! That would explain everything! Looks like I will have to re-code the entire script to work around this. Thanks for the help.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to export to wind 8...getting error. 0 Answers

windows 8.1, won't export out to win8 1 Answer

Why am I getting this error exporting to win 8 store? 0 Answers

Moving File Failed 0 Answers

Windows Phone 8 - No Network? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges