• FPC snippet.

    From j b l@1:154/700 to All on Thu Jan 26 19:50:18 2017
    Hi,

    I have some FPC code, that isn't working the way it should.

    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2 '+fn+'.MIX');

    It works like this. It checks for the existence of, say, SOMEBOARD.PK2, and if that file exists, it moves it to SOMEBOARD.MIX. The problem is that it isn't moving the file(s).

    Does this look right?

    Thanks,
    -ignatius
    --- SBBSecho 3.00-Linux
    * Origin: thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin) (1:154/700)
  • From Will Vincent@3:770/100 to j b l on Fri Jan 27 18:24:36 2017
    Is there any reason you're not wanting to use the Rename procedure that's
    part of the fpc system library?

    www.freepascal.org/docs-html/rtl/system/rename.html

    One problem with your code is that it would depend on a *nix style operating system, and that the 'mv' command is available at your specified path. Obviously that makes your code less portable. That might not matter, but if it's potentially a concern it's worth noting.

    --- Mystic BBS v1.12 A31 (Windows)
    * Origin: Agency BBS | telnet://agency.bbs.geek.nz (3:770/100)
  • From j b l@1:154/700 to Will Vincent on Fri Jan 27 04:09:32 2017
    Re: Re: FPC snippet.
    By: Will Vincent to j b l on Fri Jan 27 2017 06:24 pm

    Is there any reason you're not wanting to use the Rename procedure that's part of the fpc system library?

    Because it simply does not work. In fact, everything i've tried involving the "fn" variable does not work. I'm tearing my hair out over this. I simply cannot figure it out. If someone could take a look at http://www.catch22bbs.com/msgpack.pas , i'd appreciate it. I'm still a newbie with (Free) Pascal, so there are obviously some things that I would miss. Sudden Death offered his help, but it ended up not working as well. :(

    Thanks,
    -ignatius
    --- SBBSecho 3.00-Linux
    * Origin: thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin) (1:154/700)
  • From Nicholas Boel@1:154/10 to j b l on Fri Jan 27 08:16:22 2017
    Hello j,

    On Thu Jan 26 2017 19:50:18, j b l wrote to All:

    I have some FPC code, that isn't working the way it should.

    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2
    '+fn+'.MIX');

    Was this a typo? Or should the first instance of "fn" have a "+" before it as well?

    Regards,
    Nick

    ... "Не знаю. Я здесь только работаю."
    --- GoldED+/LNX 1.1.5-b20161221
    * Origin: thePharcyde_ distribution system (Wisconsin) (1:154/10)
  • From Wilfred van Velzen@2:280/464 to Nicholas Boel on Fri Jan 27 19:22:06 2017
    Hi,

    On 2017-01-27 08:16:22, Nicholas Boel wrote to j b l:
    about: "FPC snippet.":

    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2
    '+fn+'.MIX');

    Was this a typo? Or should the first instance of "fn" have a "+" before it as well?

    You're showing you are not a programmer! ;)

    + Is the operator to concatenate two strings together. So you are not puting it
    just in front of a string or string variable, but between them...

    Bye, Wilfred.


    --- FMail-W32 1.73.14.71-B20170123
    * Origin: Native IPv6 connectable node (2:280/464)
  • From Nicholas Boel@1:154/10 to Wilfred van Velzen on Fri Jan 27 13:33:42 2017
    Hello Wilfred,

    On Fri Jan 27 2017 19:22:06, Wilfred van Velzen wrote to Nicholas Boel:


    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2
    '+fn+'.MIX');

    Was this a typo? Or should the first instance of "fn" have a "+"
    before it as well?

    You're showing you are not a programmer! ;)

    + Is the operator to concatenate two strings together. So you are not puting it just in front of a string or string variable, but between them...

    There's usually a lot more spacing in what I've seen in the past, so.. oh well.
    I tried.

    Regards,
    Nick

    ... "Не знаю. Я здесь только работаю."
    --- GoldED+/LNX 1.1.5-b20161221
    * Origin: thePharcyde_ distribution system (Wisconsin) (1:154/10)
  • From j b l@1:154/700 to Nicholas Boel on Sat Jan 28 05:47:46 2017
    Re: FPC snippet.
    By: Nicholas Boel to j b l on Fri Jan 27 2017 08:16 am

    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2
    '+fn+'.MIX');

    Was this a typo? Or should the first instance of "fn" have a "+" before it as well?

    Nah. The first "+" is usually appended on to something that "continues" the argument. If that makes sense. The first argument usually doesn't have it.

    Thanks,
    ignatius
    --- SBBSecho 3.00-Linux
    * Origin: thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin) (1:154/700)
  • From mark lewis@1:3634/12.73 to Nicholas Boel on Sat Jan 28 13:19:24 2017

    On 2017 Jan 27 08:16:22, you wrote to j b l:

    Hello j,

    On Thu Jan 26 2017 19:50:18, j b l wrote to All:

    I have some FPC code, that isn't working the way it should.

    if FileExists(fn+'.PK2') then shell('/usr/bin/mv '+fn+'.PK2
    '+fn+'.MIX');

    Was this a typo? Or should the first instance of "fn" have a "+" before it as well?

    no, not a typo... read the ""properly formatted""* routine like this


    if FileExists(fn+'.PK2') then
    shell('/usr/bin/mv ' + fn + '.PK2 ' + fn + '.MIX');


    the pluses, in this case, are appending strings together...

    i'd be interested in what the variable "fn" contains... i'd also be concerned about that forced caps stuff with ".PK2" which may be lower case on some file systems which may be case sensitive...



    [* NOTE: formatting discussions/disagreements have resulted in some extremely heated battles.]

    )\/(ark

    Always Mount a Scratch Monkey
    Do you manage your own servers? If you are not running an IDS/IPS yer doin' it wrong...
    ... 1 in every 4 Americans has appeared on television.
    ---
    * Origin: (1:3634/12.73)