~midori/midori/trunk

« back to all changes in this revision

Viewing changes to midori/midori-download.vala

  • Committer: tuxator at o2
  • Date: 2016-01-10 13:08:08 UTC
  • mto: This revision was merged to the branch mainline in revision 7089.
  • Revision ID: tuxator@o2.pl-20160110130808-q2vrrt29l6nlz1yc
Add helper function for checking if file exists

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
        }
342
342
 
343
343
        public string get_unique_filename (string filename) {
344
 
            if (Posix.access (filename, Posix.F_OK) == 0) {
 
344
            if (Midori.Paths.check_file_exists (filename)) {
345
345
                string basename;
346
346
                string? extension = get_extension_for_uri (filename, out basename);
347
347
                string? new_filename = null;
348
348
                int i = 0;
349
349
                do {
350
350
                    new_filename = "%s-%d%s".printf (basename, i++, extension ?? "");
351
 
                } while (Posix.access (new_filename, Posix.F_OK) == 0);
 
351
                } while (Midori.Paths.check_file_exists (new_filename));
352
352
                return new_filename;
353
353
            }
354
354
            return filename;