コード例 #1
0
int roadmap_sound_list_add_buf (RoadMapSoundList list, void* buf, size_t size )
{
   char path[512];
   int file_num = list->count;
   RoadMapFile file;

   if (list->count == MAX_SOUND_LIST) return SND_LIST_ERR_LIST_FULL;

   list->buf_list[list->count] = buf;
   list->buf_list_sizes[list->count] = size;


   /*
    * Temporary solution - write the buffer to the file for further playing
    * AGA
    */
   sprintf( path, "%s/tmp/%d", roadmap_path_tts(), file_num );
   if ( file_num == 0 )
   {
      roadmap_path_create( roadmap_path_parent( path, NULL ) );
   }

   file = roadmap_file_open( path, "w" );
   roadmap_file_write( file, buf, size );
   roadmap_file_close( file );

   strncpy_safe( list->list[list->count], path, 512 );


   list->count++;

   return list->count - 1;
}
コード例 #2
0
ファイル: tts_db.c プロジェクト: Daoudai/waze-qt
void tts_db_generate_path( const char* voice_id, TtsPath* db_path )
{
   static char s_voice_id[TTS_VOICE_MAXLEN] = {0};
   static unsigned long counter = 0;
   char path_suffix[TTS_PATH_MAXLEN];
   const EpochTimeMicroSec* time_now = roadmap_time_get_epoch_us( NULL );


   if ( !db_path )
      return;

   // File name
   snprintf( path_suffix, sizeof( path_suffix ), "%s//%s//%lu-%lu-%lu.%s", TTS_DB_FILES_ROOT_DIR, voice_id,
         time_now->epoch_sec, time_now->usec, counter++, TTS_RESULT_FILE_NAME_EXT );
   // Full path
   roadmap_path_format( db_path->path, TTS_PATH_MAXLEN, roadmap_path_tts(), path_suffix );

   if ( strcmp( s_voice_id, voice_id ) ) // Save io time
   {
      char* parent = roadmap_path_parent( db_path->path, NULL );
      strncpy_safe( s_voice_id, voice_id, TTS_VOICE_MAXLEN );
      // Create path if not exists
      roadmap_path_create( parent );
      free( parent );
   }
}
コード例 #3
0
ファイル: editor_db.c プロジェクト: GitPicz/waze
int editor_db_open (int map_id) {

   char name[100];
   const char *map_path;
   char file_name[512];
   int do_read = 0;

   editor_log_push ("editor_db_open");
	
#ifndef IPHONE
   map_path = roadmap_db_map_path();
#else
	map_path = roadmap_path_preferred("maps");
#endif //IPHONE
	
	if (!map_path) {
      editor_log (ROADMAP_ERROR, "Can't find editor path");
      editor_log_pop ();
      return -1;
	}

   snprintf (name, sizeof(name), "edt%05d.dat", map_id);

   roadmap_path_format (file_name, sizeof (file_name), map_path, name);

   if (roadmap_file_exists (map_path, name)) {
      EditorDataFile = roadmap_file_open(file_name, "rw");  
      do_read = 1;
   } else {
      roadmap_path_create (map_path);
      EditorDataFile = roadmap_file_open(file_name, "w");
      roadmap_file_write (EditorDataFile, &DB_SIGNATURE, sizeof (int));
   }

	do {
	   if (!ROADMAP_FILE_IS_VALID(EditorDataFile)) {
	      editor_log (ROADMAP_ERROR, "Can't open/create new database: %s/%s",
	            map_path, name);
	      editor_log_pop ();
	      return -1;
	   }
	
	   if (do_read) {
   		do_read = 0;
	   	if (editor_db_read () == -1) {
	   		editor_db_free ();
	   		//roadmap_messagebox("Error", "Offline data file is currupt: Re-Initializing data");
	   		roadmap_log (ROADMAP_ERROR, "Offline data file is currupt: Re-Initializing data");
	   		roadmap_file_close (EditorDataFile);
	   		roadmap_file_remove (NULL, file_name);
		      EditorDataFile = roadmap_file_open(file_name, "w");
      		roadmap_file_write (EditorDataFile, &DB_SIGNATURE, sizeof (int));
	   	}
	   }
	} while (do_read);

   EditorActiveMap = map_id;
   editor_log_pop ();
   return 0;
}
コード例 #4
0
ファイル: editor_db.c プロジェクト: NNN-zz/Freemap-waze
int editor_db_open (int map_id) {

   char name[100];
   const char *map_path;
   char *file_name;
   int do_read = 0;

   editor_log_push ("editor_db_open");

   map_path = roadmap_db_map_path();

	if (!map_path) {
      editor_log (ROADMAP_ERROR, "Can't find editor path");
      editor_log_pop ();
      return -1;
	}

   snprintf (name, sizeof(name), "edt%05d.dat", map_id);

   file_name = roadmap_path_join(map_path, name);

   if (roadmap_file_exists (map_path, name)) {
      EditorDataFile = roadmap_file_open(file_name, "rw");  
      do_read = 1;
   } else {
      roadmap_path_create (map_path);
      EditorDataFile = roadmap_file_open(file_name, "w");
   }
#ifdef WIN32
   roadmap_path_free(map_path);
#endif

	do {
	   if (!ROADMAP_FILE_IS_VALID(EditorDataFile)) {
	      editor_log (ROADMAP_ERROR, "Can't open/create new database: %s/%s",
	            map_path, name);
		   roadmap_path_free(file_name);
	      editor_log_pop ();
	      return -1;
	   }
	
	   if (do_read) {
   		do_read = 0;
	   	if (editor_db_read () == -1) {
	   		editor_db_free ();
	   		roadmap_messagebox("Error", "Offline data file is currupt: Re-Initializing data");
	   		roadmap_file_close (EditorDataFile);
	   		roadmap_file_remove (NULL, file_name);
		      EditorDataFile = roadmap_file_open(file_name, "w");
	   	}
	   }
	} while (do_read);

   roadmap_path_free(file_name);
   EditorActiveMap = map_id;
   editor_log_pop ();
   return 0;
}
コード例 #5
0
ファイル: roadmap_path.c プロジェクト: NoamSheffer/WazeWP7
const char *roadmap_path_debug( void )
{
   static char *RoadMapPathDebug = NULL;

   if ( RoadMapPathDebug == NULL )
   {
      RoadMapPathDebug = roadmap_path_join( roadmap_path_user(), "debug" );
      roadmap_path_create( RoadMapPathDebug );
   }
   return RoadMapPathDebug;
}
コード例 #6
0
ファイル: roadmap_path.c プロジェクト: NoamSheffer/WazeWP7
const char *roadmap_path_images( void )
{
   static char *RoadMapPathImages = NULL;

   if ( RoadMapPathImages == NULL )
   {
	  RoadMapPathImages = roadmap_path_cat( roadmap_path_user(), "images" );
	  roadmap_path_create( RoadMapPathImages );
   }
   return RoadMapPathImages;
}
コード例 #7
0
ファイル: roadmap_path.c プロジェクト: NoamSheffer/WazeWP7
const char *roadmap_path_gps (void)
{
   static char *RoadMapGps = NULL;

   if (RoadMapGps == NULL)
   {
	  RoadMapGps = roadmap_path_cat (roadmap_path_user(), RoadMapPathGpsSuffix );
      roadmap_path_create( RoadMapGps );
   }
   return RoadMapGps;
}
コード例 #8
0
ファイル: editor_marker.c プロジェクト: NNN-zz/Freemap-waze
void editor_marker_voice_file(int marker, char *file, int size) {
    char *path = roadmap_path_join (roadmap_path_user (), "markers");
    char file_name[100];
    char *full_name;

    roadmap_path_create (path);
    snprintf (file_name, sizeof(file_name), "voice_%d.wav", marker);

    full_name = roadmap_path_join (path, file_name);
    strncpy_safe (file, full_name, size);

    roadmap_path_free (full_name);
    roadmap_path_free (path);
}
コード例 #9
0
ファイル: roadmap_path.c プロジェクト: NoamSheffer/WazeWP7
const char *roadmap_path_trips (void)
{
   static char  RoadMapDefaultTrips[] = "trips";
   static char *RoadMapTrips = NULL;

   if (RoadMapTrips == NULL) {

      RoadMapTrips =
         roadmap_path_cat (roadmap_path_user(), RoadMapDefaultTrips);

      roadmap_path_create(RoadMapTrips);
   }
   return RoadMapTrips;
}
コード例 #10
0
ファイル: editor_sync.c プロジェクト: ranyaof/waze-qt
const char *editor_sync_get_export_path (void) {

    static char path[1024];
    static int initialized = 0;

    if (!initialized) {
#ifdef IPHONE
        roadmap_path_format (path, sizeof (path), roadmap_path_preferred("maps"), "queue");
#else
        roadmap_path_format (path, sizeof (path), roadmap_db_map_path (), "queue");
#endif //IPHONE
        roadmap_path_create (path);
        initialized = 1;
    }

    return path;
}