comparison src/os_win32.c @ 819:23f82b5d2814 v7.0c10

updated for version 7.0c10
author vimboss
date Wed, 05 Apr 2006 20:41:53 +0000
parents a1a08851eac8
children 8bebcabccc2c
comparison
equal deleted inserted replaced
818:1f929f3ca806 819:23f82b5d2814
211 211
212 static void 212 static void
213 get_exe_name(void) 213 get_exe_name(void)
214 { 214 {
215 char temp[256]; 215 char temp[256];
216 static int did_set_PATH = FALSE;
216 217
217 if (exe_name == NULL) 218 if (exe_name == NULL)
218 { 219 {
219 /* store the name of the executable, may be used for $VIM */ 220 /* store the name of the executable, may be used for $VIM */
220 GetModuleFileName(NULL, temp, 255); 221 GetModuleFileName(NULL, temp, 255);
221 if (*temp != NUL) 222 if (*temp != NUL)
222 exe_name = FullName_save((char_u *)temp, FALSE); 223 exe_name = FullName_save((char_u *)temp, FALSE);
224 }
225
226 if (!did_set_PATH && exe_name != NULL)
227 {
228 char_u *p;
229 char_u *newpath;
230
231 /* Append our starting directory to $PATH, so that when doing "!xxd"
232 * it's found in our starting directory. Needed because SearchPath()
233 * also looks there. */
234 p = mch_getenv("PATH");
235 newpath = alloc((unsigned)(STRLEN(p) + STRLEN(exe_name) + 2));
236 if (newpath != NULL)
237 {
238 STRCPY(newpath, p);
239 STRCAT(newpath, ";");
240 vim_strncpy(newpath + STRLEN(newpath), exe_name,
241 gettail_sep(exe_name) - exe_name);
242 vim_setenv((char_u *)"PATH", newpath);
243 vim_free(newpath);
244 }
245
246 did_set_PATH = TRUE;
223 } 247 }
224 } 248 }
225 249
226 #if defined(DYNAMIC_GETTEXT) || defined(PROTO) 250 #if defined(DYNAMIC_GETTEXT) || defined(PROTO)
227 # ifndef GETTEXT_DLL 251 # ifndef GETTEXT_DLL
4931 command line arguments added to 4955 command line arguments added to
4932 the argument list */ 4956 the argument list */
4933 static int used_file_count = 0; /* nr of entries in used_file_indexes */ 4957 static int used_file_count = 0; /* nr of entries in used_file_indexes */
4934 static int used_file_literal = FALSE; /* take file names literally */ 4958 static int used_file_literal = FALSE; /* take file names literally */
4935 static int used_file_full_path = FALSE; /* file name was full path */ 4959 static int used_file_full_path = FALSE; /* file name was full path */
4960 static int used_file_diff_mode = FALSE; /* file name was with diff mode */
4936 static int used_alist_count = 0; 4961 static int used_alist_count = 0;
4937 4962
4938 4963
4939 /* 4964 /*
4940 * Get the command line arguments. Unicode version. 4965 * Get the command line arguments. Unicode version.
4999 * Remember "name" is an argument that was added to the argument list. 5024 * Remember "name" is an argument that was added to the argument list.
5000 * This avoids that we have to re-parse the argument list when fix_arg_enc() 5025 * This avoids that we have to re-parse the argument list when fix_arg_enc()
5001 * is called. 5026 * is called.
5002 */ 5027 */
5003 void 5028 void
5004 used_file_arg(char *name, int literal, int full_path) 5029 used_file_arg(char *name, int literal, int full_path, int diff_mode)
5005 { 5030 {
5006 int i; 5031 int i;
5007 5032
5008 if (used_file_indexes == NULL) 5033 if (used_file_indexes == NULL)
5009 return; 5034 return;
5014 used_file_indexes[used_file_count++] = i; 5039 used_file_indexes[used_file_count++] = i;
5015 break; 5040 break;
5016 } 5041 }
5017 used_file_literal = literal; 5042 used_file_literal = literal;
5018 used_file_full_path = full_path; 5043 used_file_full_path = full_path;
5044 used_file_diff_mode = diff_mode;
5019 } 5045 }
5020 5046
5021 /* 5047 /*
5022 * Remember the length of the argument list as it was. If it changes then we 5048 * Remember the length of the argument list as it was. If it changes then we
5023 * leave it alone when 'encoding' is set. 5049 * leave it alone when 'encoding' is set.
5070 { 5096 {
5071 idx = used_file_indexes[i]; 5097 idx = used_file_indexes[i];
5072 str = ucs2_to_enc(ArglistW[idx], NULL); 5098 str = ucs2_to_enc(ArglistW[idx], NULL);
5073 if (str != NULL) 5099 if (str != NULL)
5074 { 5100 {
5101 #ifdef FEAT_DIFF
5102 /* When using diff mode may need to concatenate file name to
5103 * directory name. Just like it's done in main(). */
5104 if (used_file_diff_mode && mch_isdir(str) && GARGCOUNT > 0
5105 && !mch_isdir(alist_name(&GARGLIST[0])))
5106 {
5107 char_u *r;
5108
5109 r = concat_fnames(str, gettail(alist_name(&GARGLIST[0])), TRUE);
5110 if (r != NULL)
5111 {
5112 vim_free(str);
5113 str = r;
5114 }
5115 }
5116 #endif
5075 /* Re-use the old buffer by renaming it. When not using literal 5117 /* Re-use the old buffer by renaming it. When not using literal
5076 * names it's done by alist_expand() below. */ 5118 * names it's done by alist_expand() below. */
5077 if (used_file_literal) 5119 if (used_file_literal)
5078 buf_set_name(fnum_list[i], str); 5120 buf_set_name(fnum_list[i], str);
5079 5121