示例#1
0
static char *getPfaEditPrefs(void) {
    static char *prefs=NULL;
    char buffer[1025];

    if ( prefs!=NULL )
return( prefs );
    if ( getPfaEditDir(buffer)==NULL )
return( NULL );
    sprintf(buffer,"%s/prefs", getPfaEditDir(buffer));
    prefs = copy(buffer);
return( prefs );
}
示例#2
0
static void initlibltdl(void) {
    char buffer[2000];

    if (!plugins_are_initialized()) {
        init_plugins();
        if (getPfaEditDir(buffer)!=NULL ) {
            strcpy(buffer,getPfaEditDir(buffer));
            strcat(buffer,"/plugins");
            lt_dladdsearchdir(strdup(buffer));
        }
    }
}
示例#3
0
/**
 * Return the file name of the user defined hotkeys.
 * The return value must be freed by the caller.
 *
 * If extension is not null it will be postpended to the retuned path.
 * This way you get to avoid dealing with appending to a string in c.
 */
static char *getHotkeyFilename( char* extension ) {
    char *ret=NULL;
    char buffer[1025];

    if ( getPfaEditDir(buffer)==NULL ) {
	fprintf(stderr,_("Can not work out where your hotkey definition file is!\n"));
	return( NULL );
    }
    if( !extension )
	extension = "";
    
    sprintf(buffer,"%s/hotkeys%s", getPfaEditDir(buffer), extension);
    ret = copy(buffer);
    return( ret );
}
示例#4
0
static char *getAutoDirName(char *buffer) {
    char *dir=getPfaEditDir(buffer);

    if ( dir==NULL )
return( NULL );
    sprintf(buffer,"%s/autosave", dir);
    if ( access(buffer,F_OK)==-1 )
	if ( GFileMkDir(buffer)==-1 )
return( NULL );
    dir = copy(buffer);
return( dir );
}
示例#5
0
文件: plugins.c 项目: simi/fontforge
void LoadPluginDir(char *dir) {
    DIR *diro;
    struct dirent *ent;
    char buffer[1025];

    if ( dir==NULL ) {
	/* First load system plug-ins */
#if defined( PLUGINDIR )
	LoadPluginDir( PLUGINDIR );
#else
	char *pt = getFontForgeShareDir();
	if ( pt!=NULL ) {
	    snprintf(buffer, sizeof(buffer), "%s/plugins", pt );
	    LoadPluginDir( buffer );
	}
#endif
	/* Then load user defined ones */
	if ( getPfaEditDir(buffer)!=NULL ) {
	    strcpy(buffer,getPfaEditDir(buffer));
	    strcat(buffer,"/plugins");
	    LoadPluginDir(buffer);
	}
return;
    }

    diro = opendir(dir);
    if ( diro==NULL )		/* It's ok not to have any plugins */
return;

    while ( (ent = readdir(diro))!=NULL ) {
	if ( isdyname(ent->d_name) ) {
	    sprintf( buffer, "%s/%s", dir, ent->d_name );
	    LoadPlugin(buffer);
	}
    }
    closedir(diro);
}
示例#6
0
static int ReopenLastFonts(void) {
    char buffer[1024];
    char *ffdir = getPfaEditDir(buffer);
    FILE *old;
    int any = 0;

    if ( ffdir==NULL )
return( false );
    sprintf( buffer, "%s/FontsOpenAtLastQuit", ffdir );
    old = fopen(buffer,"r");
    if ( old==NULL )
return( false );
    while ( fgets(buffer,sizeof(buffer),old)!=NULL ) {
	if ( ViewPostScriptFont(g_strchomp(buffer),0)!=0 )
	    any = 1;
    }
    fclose(old);
return( any );
}