@@ -613,14 +613,32 @@ pgBackupCompareIdDesc(const void *l, const void *r)
613
613
*/
614
614
void
615
615
pgBackupGetPath (const pgBackup * backup ,char * path ,size_t len ,const char * subdir )
616
+ {
617
+ pgBackupGetPath2 (backup ,path ,len ,subdir ,NULL );
618
+ }
619
+
620
+ /*
621
+ * Construct absolute path of the backup directory.
622
+ * Append "subdir1" and "subdir2" to the backup directory.
623
+ */
624
+ void
625
+ pgBackupGetPath2 (const pgBackup * backup ,char * path ,size_t len ,
626
+ const char * subdir1 ,const char * subdir2 )
616
627
{
617
628
char * datetime ;
618
629
619
630
datetime = base36enc (backup -> start_time );
620
- if (subdir )
621
- snprintf (path ,len ,"%s/%s/%s" ,backup_instance_path ,datetime ,subdir );
631
+
632
+ /* If "subdir1" is NULL do not check "subdir2" */
633
+ if (!subdir1 )
634
+ snprintf (path ,len ,"%s/%s/%s" ,backup_path ,BACKUPS_DIR ,datetime );
635
+ else if (!subdir2 )
636
+ snprintf (path ,len ,"%s/%s/%s/%s" ,backup_path ,BACKUPS_DIR ,datetime ,subdir1 );
637
+ /* "subdir1" and "subdir2" is not NULL */
622
638
else
623
- snprintf (path ,len ,"%s/%s" ,backup_instance_path ,datetime );
639
+ snprintf (path ,len ,"%s/%s/%s/%s/%s" ,backup_path ,BACKUPS_DIR ,
640
+ datetime ,subdir1 ,subdir2 );
641
+
624
642
free (datetime );
625
643
626
644
make_native_path (path );