Anyone Know A .saf Creator For Mac

Post your questions here
Post Reply
RyanWebley
Posts: 7
Joined: Tue Feb 11, 2020 6:18 am
Team: Privateer

Anyone Know A .saf Creator For Mac

Post by RyanWebley »

just wondering if anyone knows a .saf creator that works on Mac or if anyone has a working python script for the latest version of python and could explain how to use the script, any help would be much appreciated.
jlv
Site Admin
Posts: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Anyone Know A .saf Creator For Mac

Post by jlv »

Here's a bash script I use on Linux. I'm pretty sure people have used this on Macs before.

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
        shift

        for f in "$@"
        do
                if ! test -f "$f"
                then
                        echo 1>&2 "error: $f is not a regular file"
                        exit 1
                fi

                wc -c "$f" | (read size name; echo "$size $f")
        done

        echo -

        cat "$@"
else
        echo "To create an archive use: saf.sf c files..."
        echo "To extract an archive use: saf.sf x"
fi
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
RyanWebley
Posts: 7
Joined: Tue Feb 11, 2020 6:18 am
Team: Privateer

Re: Anyone Know A .saf Creator For Mac

Post by RyanWebley »

jlv wrote:Here's a bash script I use on Linux. I'm pretty sure people have used this on Macs before.

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
        shift

        for f in "$@"
        do
                if ! test -f "$f"
                then
                        echo 1>&2 "error: $f is not a regular file"
                        exit 1
                fi

                wc -c "$f" | (read size name; echo "$size $f")
        done

        echo -

        cat "$@"
else
        echo "To create an archive use: saf.sf c files..."
        echo "To extract an archive use: saf.sf x"
fi
This is probably obvious but where and how would I use this script?
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Anyone Know A .saf Creator For Mac

Post by Wahlamt »

RyanWebley wrote:
jlv wrote:Here's a bash script I use on Linux. I'm pretty sure people have used this on Macs before.

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
        shift

        for f in "$@"
        do
                if ! test -f "$f"
                then
                        echo 1>&2 "error: $f is not a regular file"
                        exit 1
                fi

                wc -c "$f" | (read size name; echo "$size $f")
        done

        echo -

        cat "$@"
else
        echo "To create an archive use: saf.sf c files..."
        echo "To extract an archive use: saf.sf x"
fi
This is probably obvious but where and how would I use this script?
Copy all lines of the code, paste it into textEdit. Save it like "saf.sh" (make sure it's the .sh extension, not .rtf or whatever the default option is. The you can run the file from the terminal.
RyanWebley
Posts: 7
Joined: Tue Feb 11, 2020 6:18 am
Team: Privateer

Re: Anyone Know A .saf Creator For Mac

Post by RyanWebley »

Wahlamt wrote:
RyanWebley wrote:
jlv wrote:Here's a bash script I use on Linux. I'm pretty sure people have used this on Macs before.

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
        shift

        for f in "$@"
        do
                if ! test -f "$f"
                then
                        echo 1>&2 "error: $f is not a regular file"
                        exit 1
                fi

                wc -c "$f" | (read size name; echo "$size $f")
        done

        echo -

        cat "$@"
else
        echo "To create an archive use: saf.sf c files..."
        echo "To extract an archive use: saf.sf x"
fi
This is probably obvious but where and how would I use this script?
Copy all lines of the code, paste it into textEdit. Save it like "saf.sh" (make sure it's the .sh extension, not .rtf or whatever the default option is. The you can run the file from the terminal.
lol still not getting it, would be good if you could make one of those tutorials you seem to be so good at ;)
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Anyone Know A .saf Creator For Mac

Post by Wahlamt »

RyanWebley wrote:
Wahlamt wrote:
RyanWebley wrote: This is probably obvious but where and how would I use this script?
Copy all lines of the code, paste it into textEdit. Save it like "saf.sh" (make sure it's the .sh extension, not .rtf or whatever the default option is. The you can run the file from the terminal.
lol still not getting it, would be good if you could make one of those tutorials you seem to be so good at ;)
Maybe some day soon 8)
jlv
Site Admin
Posts: 14928
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Anyone Know A .saf Creator For Mac

Post by jlv »

RyanWebley wrote:
jlv wrote:Here's a bash script I use on Linux. I'm pretty sure people have used this on Macs before.

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
        shift

        for f in "$@"
        do
                if ! test -f "$f"
                then
                        echo 1>&2 "error: $f is not a regular file"
                        exit 1
                fi

                wc -c "$f" | (read size name; echo "$size $f")
        done

        echo -

        cat "$@"
else
        echo "To create an archive use: saf.sf c files..."
        echo "To extract an archive use: saf.sf x"
fi
This is probably obvious but where and how would I use this script?
On Linux you'd do this:

1. Open a terminal.
2. Type "cat >saf.sh" and press enter.
3. Paste the script contents and press ctrl-d. (You should see the shell prompt again when you press ctrl-d.)
4. Type "chmod +x saf.sh" and press enter.

Now you should be able to run the script like this: "~/saf.sh c test.png >test.saf"

You're generally going to want to cd to the correct directory first, e.g. "cd ~/.wine/drive_c/users/ryan/Local\ Settings/Application\ Data/MX\ Simulator/", then "~/saf.sh c mytrack/* >mytrack.saf".
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Post Reply