Changeset 236

Show
Ignore:
Timestamp:
07/10/07 11:36:35 (2 years ago)
Author:
rentzsch
Message:

[NEW] mogenerator 1.3. Add -templatePath argument.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cocoa/mogenerator/mogenerator.m

    r228 r236  
    138138 
    139139NSString *ApplicationSupportSubdirectoryName = @"mogenerator"; 
     140NSString *gTemplatePath = nil; 
    140141static NSString* appSupportFileNamed(NSString *fileName_) { 
    141         NSArray *appSupportDirectories = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask+NSLocalDomainMask, YES); 
    142         assert(appSupportDirectories); 
    143          
    144142        NSFileManager *fileManager = [NSFileManager defaultManager]; 
    145143        BOOL isDirectory; 
    146144         
    147         nsenumerate (appSupportDirectories, NSString*, appSupportDirectory) { 
    148                 if ([fileManager fileExistsAtPath:appSupportDirectory isDirectory:&isDirectory]) { 
    149                         NSString *appSupportSubdirectory = [appSupportDirectory stringByAppendingPathComponent:ApplicationSupportSubdirectoryName]; 
    150                         if ([fileManager fileExistsAtPath:appSupportSubdirectory isDirectory:&isDirectory] && isDirectory) { 
    151                                 NSString *appSupportFile = [appSupportSubdirectory stringByAppendingPathComponent:fileName_]; 
    152                                 if ([fileManager fileExistsAtPath:appSupportFile isDirectory:&isDirectory] && !isDirectory) { 
    153                                         return appSupportFile; 
     145        if (gTemplatePath) { 
     146                if ([fileManager fileExistsAtPath:gTemplatePath isDirectory:&isDirectory] && isDirectory) { 
     147                        return [gTemplatePath stringByAppendingPathComponent:fileName_]; 
     148                } 
     149        } else { 
     150                NSArray *appSupportDirectories = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask+NSLocalDomainMask, YES); 
     151                assert(appSupportDirectories); 
     152                 
     153                nsenumerate (appSupportDirectories, NSString*, appSupportDirectory) { 
     154                        if ([fileManager fileExistsAtPath:appSupportDirectory isDirectory:&isDirectory]) { 
     155                                NSString *appSupportSubdirectory = [appSupportDirectory stringByAppendingPathComponent:ApplicationSupportSubdirectoryName]; 
     156                                if ([fileManager fileExistsAtPath:appSupportSubdirectory isDirectory:&isDirectory] && isDirectory) { 
     157                                        NSString *appSupportFile = [appSupportSubdirectory stringByAppendingPathComponent:fileName_]; 
     158                                        if ([fileManager fileExistsAtPath:appSupportFile isDirectory:&isDirectory] && !isDirectory) { 
     159                                                return appSupportFile; 
     160                                        } 
    154161                                } 
    155162                        } 
     
    171178        opt_model, 
    172179        opt_baseClass, 
    173         opt_includem 
     180        opt_includem, 
     181        opt_templatePath 
    174182}; 
    175183 
     
    188196                LONG_OPT(opt_baseClass, required_argument), 
    189197                LONG_OPT(opt_includem, required_argument), 
     198                LONG_OPT(opt_templatePath, required_argument), 
    190199                LONG_OPT_LAST 
    191200        }; 
     
    225234                                break; 
    226235                        case opt_version: 
    227                                 printf("mogenerator 1.2. By Jonathan 'Wolf' Rentzsch + friends.\n"); 
     236                                printf("mogenerator 1.3. By Jonathan 'Wolf' Rentzsch + friends.\n"); 
     237                                break; 
     238                        case opt_templatePath: 
     239                                gTemplatePath = [NSString stringWithUTF8String:optarg]; 
    228240                                break; 
    229241                        case opt_help: 
    230242                        default: 
    231                                 printf("mogenerator [-model /path/to/file.xcdatamodel] [-baseClass MyBaseClassMO] [-includem include.m] [-version] [-help]\n"); 
     243                                printf("mogenerator [-model /path/to/file.xcdatamodel] [-baseClass MyBaseClassMO] [-includem include.m] [-version] [-templatePath] [-help]\n"); 
    232244                                printf("Implements generation gap codegen pattern for Core Data. Inspired by eogenerator.\n"); 
    233245                } 
  • trunk/cocoa/mogenerator/mogenerator.xcodeproj/wolf.mode1

    r228 r236  
    264264                                                        <array> 
    265265                                                                <array> 
    266                                                                         <integer>12</integer> 
    267                                                                         <integer>11</integer> 
     266                                                                        <integer>2</integer> 
     267                                                                        <integer>1</integer> 
     268                                                                        <integer>0</integer> 
    268269                                                                </array> 
    269270                                                        </array> 
     
    288289                                                </array> 
    289290                                                <key>RubberWindowFrame</key> 
    290                                                 <string>1572 956 690 397 0 0 2560 1578 </string> 
     291                                                <string>881 554 690 397 0 0 1680 1028 </string> 
    291292                                        </dict> 
    292293                                        <key>Module</key> 
     
    325326                                                                <string>{{0, 0}, {376, 0}}</string> 
    326327                                                                <key>RubberWindowFrame</key> 
    327                                                                 <string>1572 956 690 397 0 0 2560 1578 </string> 
     328                                                                <string>881 554 690 397 0 0 1680 1028 </string> 
    328329                                                        </dict> 
    329330                                                        <key>Module</key> 
     
    345346                                                                <string>{{0, 5}, {376, 351}}</string> 
    346347                                                                <key>RubberWindowFrame</key> 
    347                                                                 <string>1572 956 690 397 0 0 2560 1578 </string> 
     348                                                                <string>881 554 690 397 0 0 1680 1028 </string> 
    348349                                                        </dict> 
    349350                                                        <key>Module</key> 
     
    369370                        <key>TableOfContents</key> 
    370371                        <array> 
    371                                 <string>791B1CD70BD8838600537AB8</string> 
     372                                <string>793FF9560C43E2AE00E68F6D</string> 
    372373                                <string>1CE0B1FE06471DED0097A5F4</string> 
    373                                 <string>791B1CD80BD8838600537AB8</string> 
     374                                <string>793FF9570C43E2AE00E68F6D</string> 
    374375                                <string>1CE0B20306471E060097A5F4</string> 
    375376                                <string>1CE0B20506471E060097A5F4</string> 
     
    509510        </array> 
    510511        <key>WindowString</key> 
    511         <string>1572 956 690 397 0 0 2560 1578 </string> 
     512        <string>881 554 690 397 0 0 1680 1028 </string> 
    512513        <key>WindowTools</key> 
    513514        <array> 
     
    530531                                                                <string>1CD0528F0623707200166675</string> 
    531532                                                                <key>PBXProjectModuleLabel</key> 
    532                                                                 <string></string> 
     533                                                                <string>&lt;No Editor&gt;</string> 
    533534                                                                <key>StatusBarVisibility</key> 
    534535                                                                <true/> 
     
    539540                                                                <string>{{0, 0}, {500, 218}}</string> 
    540541                                                                <key>RubberWindowFrame</key> 
    541                                                                 <string>79 1008 500 500 0 0 2560 1578 </string> 
     542                                                                <string>45 495 500 500 0 0 1680 1028 </string> 
    542543                                                        </dict> 
    543544                                                        <key>Module</key> 
     
    547548                                                </dict> 
    548549                                                <dict> 
    549                                                         <key>BecomeActive</key> 
    550                                                         <true/> 
    551550                                                        <key>ContentConfiguration</key> 
    552551                                                        <dict> 
    553                                                                 <key>PBXBuildLogShowsTranscriptDefaultKey</key> 
    554                                                                 <string>{{0, 82}, {500, 154}}</string> 
    555552                                                                <key>PBXProjectModuleGUID</key> 
    556553                                                                <string>XCMainBuildResultsModuleGUID</string> 
     
    567564                                                                <string>{{0, 223}, {500, 236}}</string> 
    568565                                                                <key>RubberWindowFrame</key> 
    569                                                                 <string>79 1008 500 500 0 0 2560 1578 </string> 
     566                                                                <string>45 495 500 500 0 0 1680 1028 </string> 
    570567                                                        </dict> 
    571568                                                        <key>Module</key> 
     
    590587                        <array> 
    591588                                <string>79D2BF1B0ACFAF4A00F3F141</string> 
    592                                 <string>791B1CD60BD8837E00537AB8</string> 
     589                                <string>793FF9660C43E7F400E68F6D</string> 
    593590                                <string>1CD0528F0623707200166675</string> 
    594591                                <string>XCMainBuildResultsModuleGUID</string> 
     
    597594                        <string>xcode.toolbar.config.build</string> 
    598595                        <key>WindowString</key> 
    599                         <string>79 1008 500 500 0 0 2560 1578 </string> 
     596                        <string>45 495 500 500 0 0 1680 1028 </string> 
    600597                        <key>WindowToolGUID</key> 
    601598                        <string>79D2BF1B0ACFAF4A00F3F141</string> 
  • trunk/cocoa/mogenerator/mogenerator.xcodeproj/wolf.pbxuser

    r228 r236  
    7373                                ); 
    7474                        }; 
    75                         PBXPerProjectTemplateStateSaveDate = 198731122
    76                         PBXWorkspaceStateSaveDate = 198731122
     75                        PBXPerProjectTemplateStateSaveDate = 205775531
     76                        PBXWorkspaceStateSaveDate = 205775531
    7777                }; 
    7878                sourceControlManager = 79D2BF0B0ACFAE0700F3F141 /* Source Control */; 
     
    8282        08FB7796FE84155DC02AAC07 /* mogenerator.m */ = { 
    8383                uiCtxt = { 
    84                         sepNavIntBoundsRect = "{{0, 0}, {1057, 4704}}"; 
    85                         sepNavSelRange = "{0, 0}"; 
     84                        sepNavIntBoundsRect = "{{0, 0}, {1057, 4872}}"; 
     85                        sepNavSelRange = "{4598, 0}"; 
    8686                        sepNavVisRect = "{{0, 0}, {1057, 777}}"; 
    87                         sepNavWindowFrame = "{{1444, 743}, {1096, 835}}"; 
     87                        sepNavWindowFrame = "{{542, 178}, {1096, 835}}"; 
    8888                }; 
    8989        };