Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
99 user(s) are online (86 user(s) are browsing Forums)

Members: 0
Guests: 99

more...

Support us!

Headlines

 
  Register To Post  

Check existence of assign
Quite a regular
Quite a regular


See User information
Hi,

Is there a function or way to check if a particular assign exists ? I want to do this from within an application but transparently so that the "Please insert volume... in any drive" requester does not pop up.

I think I could use SystemTagList() to run the assign command with the EXISTS option and send the output to a file I could then examine but his seems a rather long way around way of doing things.

Any ideas.


Bill.

Go to top
Re: Check existence of assign
Supreme Council
Supreme Council


See User information
@BillE

A IDOS->Lock() might work?

Anyway you could do something like this, perhaps not the best way but it's a way:

BOOL assignexists(STRPTR assign)
{
 
char name[256];
 
BOOL result FALSE;
 
DosList *dl IDOS->LockDosList(LDF_ASSIGNS|LDF_READ); 
 while ( (
dl=IDOS->NextDosEntry(dlLDF_ASSIGNS)) )
 {
  
IDOS->CopyStringBSTRToC(dl->dol_Namename256);

  if(
strcmp(assign,name)==0)
  {
   
result TRUE;
   break;
  }
 }

 
IDOS->UnLockDosLis(LDF_ASSIGNS);

 return 
result;
}

Vacca foeda. Sum, ergo edo

Mr Bobo Cornwater
Go to top
Re: Check existence of assign
Not too shy to talk
Not too shy to talk


See User information
@orgin

There is IDOS->FindDosEntry doing it easier.

@BillE

You can move -1 to pr_WindowPtr to avoid requesters.

Bye,
Thomas

Go to top
Re: Check existence of assign
Just popping in
Just popping in


See User information
@thomas

And since OS4 there is
APTR oldvalue IDOS->SetProcWindow( -1L );
/* do something without error requester from DOS */
...
IDOS->SetProcWindowoldvalue );

Go to top
Re: Check existence of assign
Just popping in
Just popping in


See User information
@BillE

APTR oldwin = IDOS->SetProcWindow((APTR)-1);
BPTR lock = IDOS->Lock(assign_name,SHARED_LOCK);
IDOS->UnLock(lock); /* 0 safe */
IDOS->SetProcWindow(oldwin);

if( lock )
{
IDOS->Printf("%s exists\n",assign_name);
}
else
{
IDOS->Printf("%s does not exist\n",assign_name);
}

Go to top
Re: Check existence of assign
Quite a regular
Quite a regular


See User information
@Thread


Thanks to all those that replied.

Basically all I needed to do was check if a file within an assign exists but without the requester popping up if the assign does not exist on someone's system.

APTR oldwin = IDOS->SetProcWindow((APTR)-1);
/* Do the stuff I want here */
IDOS->SetProcWindow(oldwin);

That does the trick - perfect

The function also looks useful for ensuring any requesters which I do want to keep will open on the application's screen instead of Workbench.

Excellent, thanks for the suggestions.



Bill.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project