model_server/project_ui/src/restore.cxx
// does not check if file is already loaded
does not check if file is already loaded
does not check if file is already loaded
appPtr proj_restore_file (const char* filename, const char* ln, projNode*project)
{
    Initialize(proj_restore_file);
    app* app_head = NULL;
    if(project){
        genString pset_file = get_paraset_file_name((char*)filename, project);
        int no_restore = has_paraset_file(pset_file);
        if (no_restore )
	no_restore =  ::outdated_pset(filename, (const char *)pset_file, filename);
        if (!no_restore)
	     app_head = project->restore_file(filename, ln);
        if(app_head) return app_head;
    }
    int flag = global_cache.is_ascii((const char *)filename);
    struct OStype_stat buf;
    int res = OSapi_stat((char*)filename, &buf);
    if ((res == -1 && errno != ENOENT) ||
	(res == -1 && errno == ENOENT && !buf.IWUSR())) {
	return NULL;
    }
    app_head = new objRawApp((char*)filename, 0, 0);
    if(project)
        projectNode_put_appHeader(project, app_head);
    if (!flag) {
	((objRawApp *)app_head)->is_new(1);
	projHeader::make_new_filename (filename);
    }
    return app_head;
}
appPtr proj_restore_file ( const char * filename , const char * ln , projNode * project ) { Initialize ( proj_restore_file ) ; app * app_head = NULL ; if ( project ) { genString pset_file = get_paraset_file_name ( ( char * ) filename , project ) ; int no_restore = has_paraset_file ( pset_file ) ; if ( no_restore ) no_restore = :: outdated_pset ( filename , ( const char * ) pset_file , filename ) ; if ( ! no_restore ) app_head = project -> restore_file ( filename , ln ) ; if ( app_head ) return app_head ; } int flag = global_cache . is_ascii ( ( const char * ) filename ) ; struct OStype_stat buf ; int res = OSapi_stat ( ( char * ) filename , & buf ) ; if ( ( res == -1 && errno != ENOENT ) || ( res == -1 && errno == ENOENT && ! buf . IWUSR ( ) ) ) { return NULL ; } app_head = new objRawApp ( ( char * ) filename , 0 , 0 ) ; if ( project ) projectNode_put_appHeader ( project , app_head ) ; if ( ! flag ) { ( ( objRawApp * ) app_head ) -> is_new ( 1 ) ; projHeader :: make_new_filename ( filename ) ; } return app_head ; }
does not check if file is already loaded
does not check if file is already loaded
//boris: if wrong pathname do not bother //boris: Let the Epoch handle New and non ASCII files // New file. Mapping projects 