Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
1
Question by UMSDev · Aug 19, 2018 at 10:18 PM · macmacosxosxpermissionsio

Create folders on mac

I'm trying to create folders (and files) on mac in my game in the folder provided by Unity (Application.dataPath) which leads to User/Library/Application Support/Appname

I can create the folders using a simple:

 if (!System.IO.Directory.Exists(pathMods))
         {
             System.IO.Directory.CreateDirectory(pathMods);
         }

The folder is created but I can't write anything inside. If I try to manually find the folder using Finder, it says I don't have access to it.

I haven't found any solution on google but it seems to be a pretty simple problem.

I have also tried to call this function with 777 but it didn't work:

     private static bool GrantAccess(string fullPath)
     {
         try
         {
 #if UNITY_STANDALONE_OSX
             sys_chmod(fullPath, 777);
 #else
             DirectoryInfo dInfo = new DirectoryInfo(fullPath);
             DirectorySecurity dSecurity = dInfo.GetAccessControl();
             dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
             dInfo.SetAccessControl(dSecurity);
 #endif
         }
         catch (PlatformNotSupportedException erreur)
         {
             try
             {
                 sys_chmod(fullPath, 777);
             }
             catch (Exception e2)
             {
                 LibTRANSVERSE.Helper.Monitoring.Exception(erreur2,  LibTRANSVERSE.Helper.MethodInfoHelper.GetCurrentMethod());
                 return false;
             }
         }
         catch (Exception e)
         {
             LibTRANSVERSE.Helper.Monitoring.Exception(erreur,  LibTRANSVERSE.Helper.MethodInfoHelper.GetCurrentMethod());
             return false;
         }
         return true;
     }
     [DllImport("libc", EntryPoint = "chmod", SetLastError = true)]
     private static extern int sys_chmod(string path, uint mode);

But it doesn't work.

To be complete all the folders don't have the same permissions for some reasons.

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 reysantana · Jun 02, 2020 at 02:13 AM 0
Share

Hello @U$$anonymous$$SDev did you solve this issue?,Hello @U$$anonymous$$SDev did you solve the issue?

avatar image reysantana · Jun 02, 2020 at 02:14 AM 0
Share

@U$$anonymous$$SDev did you solve this issue?

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

150 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to request Microphone Permisson for Mac OSX Standalone? 2 Answers

DepthTextureMode.Depth on Mac -> streched Image 1 Answer

Unity Player as a OS X framework 0 Answers

Unity Editor 2018.4.20f1 - Editor Window on Macintosh is translucent and empty 0 Answers

Mac Build doesn't open after download 0 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