X-Git-Url: https://cygwin.com/git/?a=blobdiff_plain;f=script.h;h=e121b6e8e46fb985de0c42b030cc80b806ac66a0;hb=c93bc6d05d1425f4a39d5c427f49cfb7dd38805b;hp=46f64fc73fef531fd4b597eeb3b9f25b6a54dc22;hpb=bc78a6d52a8dc213c18af2286ce9bf9921aea901;p=cygwin-apps%2Fsetup.git diff --git a/script.h b/script.h index 46f64fc7..e121b6e8 100644 --- a/script.h +++ b/script.h @@ -12,19 +12,31 @@ * Written by Jan Nieuwenhuizen * */ -#ifndef SCRIPT_H -#define SCRIPT_H +#ifndef SETUP_SCRIPT_H +#define SETUP_SCRIPT_H -/* Run the script fname, found in dir. If fname has suffix .sh, and - we have a Bourne shell, execute it using sh. Otherwise, if fname - has suffix .bat, execute using cmd */ +#include "String++.h" -void run_script (char const *dir, char const *fname); - /* Initialisation stuff for run_script: sh, cmd, CYGWINROOT and PATH */ void init_run_script (); /* Run the scripts fname.sh and fname.bat, found in dir. */ -void try_run_script (char const *dir, char const *fname); +void try_run_script (String const &dir, String const &fname); + +class Script { +public: + static bool isAScript (String const &file); + Script (String const &fileName); + String baseName() const; + String fullName() const; +/* Run the script. If it it's suffix is .sh, and + we have a Bourne shell, execute it using sh. Otherwise, if the + suffix is .bat, execute using cmd */ + void run() const; +private: + String scriptName; + static char const ETCPostinstall[]; + char const * extension() const; +}; -#endif /* SCRIPT_H */ +#endif /* SETUP_SCRIPT_H */