Skip to content

Commit

Permalink
When trying to locate a product, pass in proper name, so UI can refer…
Browse files Browse the repository at this point in the history
… to it.

 (i.e. - I can't find "Neverwinter Nights Dedicated Server" instead of
 "I can't find the product"). This is twice as useful for patchfiles with
 multiple products.
  • Loading branch information
icculus committed May 27, 2004
1 parent 4e7ae5e commit 4317282
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mojopatch.c
Expand Up @@ -1794,7 +1794,7 @@ static int process_patch_header(SerialArchive *ar, PatchHeader *h)

if (!info_only())
{
if (!chdir_by_identifier(h->identifier, h->version))
if (!chdir_by_identifier(h->product, h->identifier, h->version))
return(PATCHERROR);
} /* if */

Expand Down
2 changes: 1 addition & 1 deletion platform.h
Expand Up @@ -57,7 +57,7 @@ int get_file_size(const char *fname, long *fsize);
char *get_current_dir(void);
char *get_realpath(const char *path);
int spawn_xdelta(const char *cmdline);
int chdir_by_identifier(const char *id, const char *version);
int chdir_by_identifier(const char *name, const char *str, const char *ver);
int update_version(const char *ver);
int calc_tmp_filenames(char **tmp1, char **tmp2);
int show_and_install_readme(const char *fname, const char *text);
Expand Down
6 changes: 3 additions & 3 deletions platform_unix.c
Expand Up @@ -375,9 +375,9 @@ int update_version(const char *ver)
} /* update_version */


int manually_locate_product(char *buf, size_t bufsize);
int manually_locate_product(const char *name, char *buf, size_t bufsize);

int chdir_by_identifier(const char *str, const char *version)
int chdir_by_identifier(const char *name, const char *str, const char *version)
{
char buf[MAXPATHLEN];
Boolean b;
Expand All @@ -401,7 +401,7 @@ int chdir_by_identifier(const char *str, const char *version)
else
{
_log("Couldn't find product. Perhaps it isn't installed?");
if (!manually_locate_product(buf, sizeof (buf)))
if (!manually_locate_product(name, buf, sizeof (buf)))
{
_fatal("We can't patch the product if we can't find it!");
return(0);
Expand Down
15 changes: 12 additions & 3 deletions ui_carbon.c
Expand Up @@ -163,7 +163,7 @@ int ui_prompt_ny(const char *question)
} /* ui_prompt_ny */


int manually_locate_product(char *buf, size_t bufsize)
int manually_locate_product(const char *name, char *buf, size_t bufsize)
{
NavDialogCreationOptions dlgopt;
NavDialogRef dlg;
Expand All @@ -175,9 +175,18 @@ int manually_locate_product(char *buf, size_t bufsize)
OSStatus rc;
int retval = 0;
int yn;
const char *promptfmt = "We can't find your \"%s\" installation."
" Would you like to show us where it is?";
char *promptstr = alloca(strlen(name) + strlen(promptfmt) + 1);

yn = ui_prompt_yn("We can't find your installation."
" Would you like to show us where it is?");
if (promptstr == NULL)
{
_fatal("Out of memory.");
return(0);
} /* if */
sprintf(promptstr, promptfmt, name);

yn = ui_prompt_yn(promptstr);
if (!yn)
{
_log("User chose not to manually locate installation");
Expand Down

0 comments on commit 4317282

Please sign in to comment.