Author Topic: GLOBbing; when and when not to use?  (Read 1940 times)

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
GLOBbing; when and when not to use?
« on: January 24, 2005, 05:34:43 PM »
Are there any sort of guidelines for when we should and shouldn't use globbing? I don't think I've ever seen anyone copy to ~the/folder/is/in/here/*/somewhere~, but everyone still uses GLOB. How, exactly, does the GLOB flag affect both source and destination matching? (I know it's cautioned against, but it doesn't seem to make a whole heck of a lot of difference, whether on or off.) Unless there's some sort of wickedness going on with how WeiDU is matching regexps to actual files, or something I'm not thinking of about the way it expands names, does it really ever need to be used?

Sorry for being dense, but I think this is the one thing I've never been able to figure out from the read me. It says, "Avoid it if you can." Everyone says, "Use it when you can." I say "Huh"? Or something.

Offline Ghreyfain

  • PPG
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: GLOBbing; when and when not to use?
« Reply #1 on: January 24, 2005, 05:48:59 PM »
The only time I've ever used GLOB is when stealing someone else's code, so I honestly have no clue what it does.  I thought it best to keep it in there, though.
Earn Money Sleeping.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Moderator
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: GLOBbing; when and when not to use?
« Reply #2 on: January 24, 2005, 05:59:10 PM »
Basically, you should use it always when you do a COPY_EXISTING_REGEXP to affect all files of a type (all itm/spl and so on...)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: GLOBbing; when and when not to use?
« Reply #3 on: January 24, 2005, 06:16:24 PM »
Basically, you should use it always when you do a COPY_EXISTING_REGEXP to affect all files of a type (all itm/spl and so on...)

But I don't think that's what it does. If WeiDU only searches in the override and bifs (for COPY_EXISTING_anything actions), then the regexp stuff should take care of the filename matching. So, to me, it would only make sense if used for the destination directory, and only if you started using wildcards (something like COPY_whatever GLOB ~jojo~ ~o*/juju~, if you wanted to be really lazy).

But I've rarely (if ever) seen a COPY_EXISTING_REGEXP without the GLOB (unless it's one of Wes's mods). Which is why I'm left scratching my head...

Hopefully, we can get The Official Word(tm). (Or not, as I'll then be tempted to change every instance of ~override~ to ~o*~, just so that the GLOB actually does something. :P)

And, if Wes does happen by, there's some TeamBG linkage in the read me (the ADD_KIT description links to the non-existent teambg.net).
« Last Edit: January 24, 2005, 07:34:03 PM by devSin »

Offline Ghreyfain

  • PPG
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: GLOBbing; when and when not to use?
« Reply #4 on: January 24, 2005, 06:47:04 PM »
Heheheh.  Maybe I'll write a mod with files in random directories all over the place in random subfolders just to make you happy.
Earn Money Sleeping.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: GLOBbing; when and when not to use?
« Reply #5 on: January 24, 2005, 06:56:39 PM »
Heheheh.  Maybe I'll write a mod with files in random directories all over the place in random subfolders just to make you happy.
When you start to get too vague, weird things can happen. Unless you're very careful, who knows what " mv */*/*/* */* " will do?

Now, if ACTION_IF lets you do RANDOM... You could make an installer that (in theory) never does the same thing twice!

Offline CamDawg

  • Infidel
  • Planewalker
  • *****
  • Posts: 859
  • Dreaming of a red Xmas
    • The Gibberlings Three
Re: GLOBbing; when and when not to use?
« Reply #6 on: January 24, 2005, 07:16:03 PM »
And, if Wes does happen by, there's some TeamBG linkage in the read me (the ADD_KIT description links to the non-existant teambg.net).

I would humbly submit http://forums.gibberlings3.net/index.php?showtopic=584 as a new link for the ADD_KIT stuff, though you may wish to skip ahead to part III where I actually start discussing using ADD_KIT.
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: GLOBbing; when and when not to use?
« Reply #7 on: January 24, 2005, 08:09:36 PM »
Let's imagine that CHITIN.KEY has two files: C1.ITM and C2.ITM. Your override contains C2.ITM and C_MOD.ITM.

COPY_EXISTING_REGEXP "C.*.ITM" "override" // catches C1.ITM, C2.ITM

COPY_EXISTING_REGEXP GLOB "C.*.ITM" "override" // catches C1.ITM, C2.ITM, C_MOD.ITM

COPY REGEXP "override/C.*.ITM" "override" // catches C2.ITM, C_MOD.ITM

To put it another way: if you do not specify GLOB with _EXISTING, WeiDU pretends that the override directory contains 0 files that are not in CHITIN.KEY.

Finally, GLOB has no effect on wildcards in the "destination" filespec.

COPY GLOB "mymod/foo" "music/*"  // this is illegal, do not do this
« Last Edit: January 24, 2005, 08:11:25 PM by weimer »

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: GLOBbing; when and when not to use?
« Reply #8 on: January 24, 2005, 08:18:14 PM »
My guess from that, then, is that the globbing provides the path to matching file, whereas plain _REGEXP stuff doesn't actually search your files (it searches your key file, and then WeiDU automagically chooses where to grab it from). Is that close enough?

Anyway, thanks for clearing this up for me.

Offline weimer

  • Moderator
  • Planewalker
  • *****
  • Posts: 2222
  • Gender: Male
    • WeiDU and Weimer Mods
Re: GLOBbing; when and when not to use?
« Reply #9 on: January 24, 2005, 08:51:47 PM »
Yes, you are correct.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: GLOBbing; when and when not to use?
« Reply #10 on: February 11, 2005, 11:15:53 AM »
For those who are curious, the semi-comprehensive list of ToB files that aren't actually in the key file:
Code: [Select]
25ELM01.WAV
25ELM02.WAV
25ELM03.WAV
25ELM04.WAV
25ELM05.WAV
25ELM06.WAV
25ELM07.WAV
25ELM08.WAV
25ELM09.WAV
25ELM10.WAV
25ELM11.WAV
25ELM12.WAV
25ELM13.WAV
25ELM14.WAV
AR2812.BCS
BAG02H.STO
BAG02I.STO
BAG03H.STO
BAG03I.STO
CHAINS.ITM
DEADABAZ.BCS
DEADBALT.BCS
DEMOARCH.CRE
DEMOCLER.CRE
GORSTAM.BCS
IAMUL26.BAM
IAMUL27.BAM
IAROW15.BAM
MUSICLIST.IDS
MXSPLDRU.2DA
NARR05.WAV
SPMDSLAY.SPL

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: