Anyone Know A .saf Creator For Mac

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

Anyone Know A .saf Creator For Mac

Postby RyanWebley » Tue Apr 07, 2020 6:11 am

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: 13661
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Anyone Know A .saf Creator For Mac

Postby jlv » Wed Apr 08, 2020 1:47 am

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: 5
Joined: Tue Feb 11, 2020 6:18 am
Team: Privateer

Re: Anyone Know A .saf Creator For Mac

Postby RyanWebley » Thu Apr 09, 2020 4:58 am

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?

User avatar
Wahlamt
Posts: 7568
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Anyone Know A .saf Creator For Mac

Postby Wahlamt » Thu Apr 09, 2020 6:30 pm

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: 5
Joined: Tue Feb 11, 2020 6:18 am
Team: Privateer

Re: Anyone Know A .saf Creator For Mac

Postby RyanWebley » Thu Apr 09, 2020 9:56 pm

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 ;)

User avatar
Wahlamt
Posts: 7568
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: Anyone Know A .saf Creator For Mac

Postby Wahlamt » Thu Apr 09, 2020 10:06 pm

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: 13661
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: Anyone Know A .saf Creator For Mac

Postby jlv » Fri Apr 10, 2020 2:26 am

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.


Return to “Help / Troubleshooting”

Who is online

Users browsing this forum: No registered users and 5 guests