Application Support Folder

Developers
Henry
2006-07-13
2013-06-05
  • Henry

    Henry - 2006-07-13

    I am trying to add a templates file, instead of built in ones, and, eventually, would like to work on plugin frameworks. Mac application conventions would have these files go in ~/Library/Application Support/Seashore/

    I have looked, but been unsuccessful in finding, the proper way to access this directory. It could be done directly by path, but that doesn't seem elegant, or wise (apple could change the layout). Is there a function that will return this directory?

    For the templates, the application will have to have a file in the bundle, and copy it to the application support folder on first start up. My initial idea for this was to have a macro for accessing the different files

    if (!pathToTemplates) [[mainBundle standardtemplates.plist] copyTo:[NSApplicationSupport mainDirectory];

    NSDictionary templates = dictionaryWithContentsOfFile: pathToTemplates;

    return templates

    Is there anywhere I can read about this?

     
    • Mark Pazolli

      Mark Pazolli - 2006-07-14

      The reason for not using the Application Support folder yet is that the plug-ins change from release-to-release. I'm not sure how to find the Application Support folder. However I would like some more information on this templates concept (as I still don't understand it). Could you please explain the idea to me first.

      Thanks,
      Mark.

       
      • Henry

        Henry - 2006-07-14

        I must have jumped ahead, and not been clear. I'm just proposing templates like the GIMP, where they are stored in a file and can be added an edited instead of being coded into the application. I would have them stored as a plist, which is accessed as an NSDicitionary, with each template being an NSDictionary with width, height, resolution, etc. I would also have another parameter to tell the application to get screen size or standard letter size.

        Having the plugins built into the application in the bundle is okay, but for user added ones, which I think are very possible, the convention seems to be Application Support.

        I'll try to find out more about Application Support.

        Here is my basic idea for the template code:

             [templatesMenu addItemsWithTitles:[templatesDictionary allKeys]];
             NSDictionary* chosenTemplate = [presetsDicionary objectForKey:[templatesMenu selectedItem]];
             if ([presetsDicionary objectForKey:"Machine Dependent Template"])
             {
                 if ([presetsDicionary objectForKey:"Machine Dependent Template"] == "Screen")
                 {
                     //run code to get screen size and pass it to the new image
                 }
             }
             else
             {
                 width = [presetsDicionary objectForKey:width];
                 height = [presetsDicionary objectForKey:height];
                 resolution = [presetsDicionary objectForKey:resolution];
                 units = [presetsDicionary objectForKey:units];
                 mode = [presetsDicionary objectForKey:width];
                 transparent = [presetsDicionary objectForKey:transparent];

             }

         
      • Henry

        Henry - 2006-07-14

        I guess templates are called presets within Seashore. That is what I was referring to.

         
      • Henry

        Henry - 2006-07-14

        I have found a good class for using the support folder, with what appears to be a GPL License. Is it okay to use it in Seashore? The license is:

        /*
        Copyright (c) 2006 Michael Bianco, <software@mabwebdesign.com>

        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
        to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
        and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
        INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
        DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
        ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        */

         
        • Mark Pazolli

          Mark Pazolli - 2006-07-18

          The software license is fine. But I am still a little concerned about the idea. It feels this would add complexity to the application when there are other areas that would be better served with attention. Furthermore, I worry the templates are not going to correctly handle page margins. Personally, I think one of the best areas to work on at the moment for Seashore is translating plug-ins from the GIMP. Send me your thoughts.

          Mark.

           
          • Stephen Siciliano

            I'm  not too concerned about the added complexity. Honestly I had planned on adding custom presets (which is why I added space for it in the Preferences window), but wanted to focus on more pressing issues first. If he wants to work on that now, I don't think it would take too much time or effort to implement the feature, and it would certainly be something i would use.

             
            • Mark Pazolli

              Mark Pazolli - 2006-07-19

              Hi Stephen,

              There's some further discussion on this issue at our Google group:

              http://groups.google.com/group/seashore-dev

              After this discussion I am happier with the proposed changes.

              Mark.

               
    • Nobody/Anonymous

      The Application Support Folder has been used/created since X.2.4 right? and surely Seashore will be updated 100 x more regularly than any Apple update major enough to change the App.Support folder structure, so why not implement a 3rd fallback path anyway? (After /Library....Support/ & ~/Library....Support).
      Couldnt hurt, adds backward compat too.
      I checked at least a dozen Apps, they all ref the App.Support Folder by path direct....*shrugs*
      Gominosensei

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks