title: How do I read from /Library/Application Support/ folder?
body: <p>I am making a OX Cocoa app and I want to be able to read and write text files using the app on button press.  These text files should be saved in /Library/Application Support/AppName but i can't get my app to reading anything from there.  It can write to the folder, but not read what it has written there, even though I can see the file sitting there in finder.  </p>
  
  <p>Here is the code I am using the successfully write to the folder.  </p>
  
  <pre><code>    NSString *text = editor.string;
      NSString *path = @"/Library/Application Support/";
  
      NSMutableString *mu = [[NSMutableString stringWithString:path] init];
      [mu insertString:FileName.stringValue atIndex:mu.length];
      [mu insertString:@".txt" atIndex:mu.length];
  
      path = [mu copy];
      [text writeToFile:path atomically:YES encoding:NSUTF8StringEncoding error:NULL];
  </code></pre>
  
  <p>Here is the code I am using (and failing) to read from the text files.  </p>
  
  <pre><code>    NSArray *path = [[NSBundle mainBundle] pathsForResourcesOfType:@"txt" inDirectory:@"/Library/Application Support/"];
      NSString *output = @"";
  
      NSMutableString *mu = [[NSMutableString stringWithString:output] init];
  
      for (int i = 0; i &lt; [path count]; i++) {
          NSString *text = [NSString stringWithContentsOfFile:path[i] encoding:NSUTF8StringEncoding error:NULL];
          [mu insertString:text atIndex:mu.length];
          [mu insertString:@"\n" atIndex:mu.length];
      }
  
      [textView setString:mu];
  </code></pre>
  
  <p>Any tips on what I can correct would be super helpful, I'm a bit stuck here.  </p>
  
  <p><strong>Edit</strong>: Using your input I have updated my code to this:</p>
  
  <pre><code>    NSString *fileLocation = @"~/Library/Application Support/";
      NSArray *text = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:fileLocation error:nil];
      NSString *output = @"";
      NSMutableString *mu = [[NSMutableString stringWithString:output] init];
  
      for (int i = 0; i &lt; [text count]; i++) {
          [mu insertString:text[i] atIndex:mu.length];
          [mu insertString:@"\n" atIndex:mu.length];
      }
      [textView setString:mu];
  </code></pre>
  
  <p>However the text from the files is still not appearing.  </p>