Loading...

LR-LoadRunner@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Regarding absolute path . André Luyer Thu Feb 23 13:00:45 2012

What I meant was that you should NOT use the full (absolute) path --
it is unnecessary.
And
- the use 'chdir(original_dir)' is superfluous.
- it still hurts my eyes when people uses strcat, use lr_param_sprintf
or the good old sprintf.

So you function should be:

Filepath()
{
  lr_save_string("DocumentToUpload.doc", "lrp_Filepath");
  ...


Cheers,
André

On Feb 23, 5:11 pm, Venkatesh T Gowda <[EMAIL PROTECTED]>
wrote:
> Hi Guys Thanks for your all valuable response ..
>
> i used the below script to make it absolute path..
>
> Filepath()
>
> {
>
>     #define DIR_LEN 512
>
>     char original_dir[DIR_LEN];
>     char fullpath[1024], * filename = "DocumentToUpload.doc";
>
>     if (!getcwd(original_dir, DIR_LEN)) {
>
>         //lr_output_message ("getcwd error");
>
>         return -1;
>
>     }
>
>     if (chdir(original_dir)) {
>
>       //  lr_output_message ("Cannot move back to %s", original_dir);
>
>         return -1;
>
>     }
>
>     else
>
>       //  lr_output_message ("Moved back to %s", original_dir);
>
>    strcpy(fullpath, original_dir);
>
>     strcat(fullpath, "\\");
>
>     strcat(fullpath, filename);
>
>   //  lr_output_message ("Full path of file is %s", fullpath);
>
>         lr_save_string(lr_eval_string(fullpath),"lrp_Filepath");
>
>         lr_output_message("Document Path 
> is:%s",lr_eval_string("{lrp_Filepath}"));
>
>
> }
> On Thu, Feb 23, 2012 at 1:44 AM, André Luyer <[EMAIL PROTECTED]> wrote:
> > When a script is run on a load generator the current working directory
> > will be the script path. Note: the function getcwd returns the name of
> > the current working directory.
> > Don't bother to move files on the load generator, just add them to
> > your script. If necessary you can create a temporary file in the
> > current directory by code in your script.
>
> > If you use web_custom_request it is possible to upload a file that
> > does _not_ exist as a real file on the load generator. (The contents
> > may be a LR parameter.)
>
> > André

-- 
You received this message because you are subscribed to the Google "LoadRunner" 
group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en