comparison src/fileio.c @ 4242:edd0bc1f26bd v7.3.872

updated for version 7.3.872 Problem: On some systems case of file names is always ignored, on others never. Solution: Add the 'fileignorecase' option to control this at runtime. Implies 'wildignorecase'.
author Bram Moolenaar <bram@vim.org>
date Tue, 19 Mar 2013 16:49:16 +0100
parents 0fcb050fd79d
children dc3efb6d5a08
comparison
equal deleted inserted replaced
4241:bd0fbce6a988 4242:edd0bc1f26bd
6483 struct stat st; 6483 struct stat st;
6484 long perm; 6484 long perm;
6485 #ifdef HAVE_ACL 6485 #ifdef HAVE_ACL
6486 vim_acl_T acl; /* ACL from original file */ 6486 vim_acl_T acl; /* ACL from original file */
6487 #endif 6487 #endif
6488 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
6489 int use_tmp_file = FALSE; 6488 int use_tmp_file = FALSE;
6490 #endif
6491 6489
6492 /* 6490 /*
6493 * When the names are identical, there is nothing to do. When they refer 6491 * When the names are identical, there is nothing to do. When they refer
6494 * to the same file (ignoring case and slash/backslash differences) but 6492 * to the same file (ignoring case and slash/backslash differences) but
6495 * the file name differs we need to go through a temp file. 6493 * the file name differs we need to go through a temp file.
6496 */ 6494 */
6497 if (fnamecmp(from, to) == 0) 6495 if (fnamecmp(from, to) == 0)
6498 { 6496 {
6499 #ifdef CASE_INSENSITIVE_FILENAME 6497 if (p_fic && STRCMP(gettail(from), gettail(to)) != 0)
6500 if (STRCMP(gettail(from), gettail(to)) != 0)
6501 use_tmp_file = TRUE; 6498 use_tmp_file = TRUE;
6502 else 6499 else
6503 #endif
6504 return 0; 6500 return 0;
6505 } 6501 }
6506 6502
6507 /* 6503 /*
6508 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted. 6504 * Fail if the "from" file doesn't exist. Avoids that "to" is deleted.
6537 && info1.nFileIndexLow == info2.nFileIndexLow) 6533 && info1.nFileIndexLow == info2.nFileIndexLow)
6538 use_tmp_file = TRUE; 6534 use_tmp_file = TRUE;
6539 } 6535 }
6540 #endif 6536 #endif
6541 6537
6542 #if defined(UNIX) || defined(CASE_INSENSITIVE_FILENAME)
6543 if (use_tmp_file) 6538 if (use_tmp_file)
6544 { 6539 {
6545 char tempname[MAXPATHL + 1]; 6540 char tempname[MAXPATHL + 1];
6546 6541
6547 /* 6542 /*
6570 return -1; 6565 return -1;
6571 } 6566 }
6572 } 6567 }
6573 return -1; 6568 return -1;
6574 } 6569 }
6575 #endif
6576 6570
6577 /* 6571 /*
6578 * Delete the "to" file, this is required on some systems to make the 6572 * Delete the "to" file, this is required on some systems to make the
6579 * mch_rename() work, on other systems it makes sure that we don't have 6573 * mch_rename() work, on other systems it makes sure that we don't have
6580 * two files when the mch_rename() fails. 6574 * two files when the mch_rename() fails.
10005 char_u *type_start; 9999 char_u *type_start;
10006 char_u c; 10000 char_u c;
10007 int match = FALSE; 10001 int match = FALSE;
10008 #endif 10002 #endif
10009 10003
10010 #ifdef CASE_INSENSITIVE_FILENAME 10004 regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
10011 regmatch.rm_ic = TRUE; /* Always ignore case */
10012 #else
10013 regmatch.rm_ic = FALSE; /* Don't ever ignore case */
10014 #endif
10015 #ifdef FEAT_OSFILETYPE 10005 #ifdef FEAT_OSFILETYPE
10016 if (*pattern == '<') 10006 if (*pattern == '<')
10017 { 10007 {
10018 /* There is a filetype condition specified with this pattern. 10008 /* There is a filetype condition specified with this pattern.
10019 * Check the filetype matches first. If not, don't bother with the 10009 * Check the filetype matches first. If not, don't bother with the