void appMakeDirectoryForFile(const char *filename) { char Name[256]; appStrncpyz(Name, filename, ARRAY_COUNT(Name)); appNormalizeFilename(Name); char *s = strrchr(Name, '/'); if (s) { *s = 0; appMakeDirectory(Name); } }
static FILE * appSpellOpenDictionary( const char * prefix, AppSpellTool * ast, int read_only ) { char * dir= ast->astPrivateDictionaries; char scratch[FILEL+ 1]; char home[FILEL+ 1]; int len; FILE * f; char * mode; len= appHomeDirectory( home, FILEL ); if ( len < 0 ) { LDEB(len); return (FILE *)0; } if ( dir[0] == '/' ) { strcpy( scratch, dir ); } else{ # ifdef __VMS sprintf( scratch, "%.*s.%s]", len- 1, home, dir ); # else sprintf( scratch, "%s/%s", home, dir ); # endif } if ( appTestDirectory( scratch ) ) { if ( read_only ) { return (FILE *)0; } if ( appMakeDirectory( scratch ) ) { AppSpellToolResources * astr= ast->astResources; appQuestionRunSubjectErrorDialog( ast->astApplication, ast->astTopWidget, (APP_WIDGET)0, scratch, astr->astrPrivDictDirNotMade ); return (FILE *)0; } } if ( dir[0] == '/' ) { sprintf( scratch, "%s/%s.changes", dir, prefix ); } else{ # ifdef __VMS char * vms_file= strchr( prefix, ']' ); sprintf( scratch, "%.*s.%s%s.changes", len- 1, home, dir, vms_file ); # else sprintf( scratch, "%s/%s/%s.changes", home, dir, prefix ); # endif } if ( read_only ) { mode= "r"; } else{ mode= "a"; } f= fopen( scratch, mode ); if ( ! f && ! read_only ) { SLDEB(scratch,errno); return (FILE *)0; } return f; }