!ifexist Macro: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(minor updates)
m (Reverted edits by RuthMartin to last version by Zinthose)
Line 52: Line 52:
     !macroend</highlight-nsis>
     !macroend</highlight-nsis>
[[Category:Compile-Time Macros]]
[[Category:Compile-Time Macros]]
== Food People Power ==
For many years, people living in West Oakland had accepted eating unhealthy food as a way of life. That is, until a small group of people decided to change their community through Mandela MarketPlace, a non-profit that partners with local residents and rural, minority farmers to bring fresh agricultural produce to their local corner stores. Mandela MarketPlace now represents the difference that youth can make by challenging prevailing paradigms - you CAN select what you put in your body.
[[http://goodvillenews.com/Food-People-Power-NPElli.html Food People Power]]
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
== Authors Nominate Top Books of All Time ==
In 2002, the Norwegian Book Clubs gathered 100 authors from 54 countries and asked each one to list the 10 best works of fiction of all time. The authors responded and this list was created. The titles are arranged alphabetically by author name, so no one book stands above any other. The following list is the groups selection of the worlds 100 best books.How many have you read?
[[http://goodvillenews.com/Authors-Nominate-Top-Books-of-All-Time-kRj65H.html Authors Nominate Top Books of All Time]]
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
== What Ive Learned About Learning ==
We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself. ~Lloyd AlexanderI am a teacher and an avid learner, and Im passionate about both.Im a teacher because I help Eva homeschool our kids OK, she does most of the work, but I do help, mostly with math but with everything else too.
[[http://goodvillenews.com/What-Ive-Learned-About-Learning-I45BZI.html What Ive Learned About Learning]]
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
== World Book Night: Millions of Free Books Donated ==
A young woman is jumping up and down in front of the New York Public Library wearing a sandwich sign that says, "Hate Reading? Talk To Me!" Shes waving around several copies of "The Glass Castle" by Jeannette Walls, eager to get them off her hands.Men and women in suits breeze by, but some passersby are curious about the spectacle. If you were roaming the streets of New York City or London last night you may have encountered a similar scene: Zealous readers handing out award-winning novels by the boxful.
[[http://goodvillenews.com/World-Book-Night-Millions-of-Free-Books-Donated-J7S8iH.html World Book Night: Millions of Free Books Donated]]
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]
== 7 Reasons Why Not Making Mistakes Is The Biggest Mistake ==
The FEAR of being nothing, achieving nothing and becoming nothing should be way bigger than the fear of making mistakes.A life spent making mistakes is not only more honorable, but more useful than a life spent doing nothing. ~ George Bernard Shaw
[[http://goodvillenews.com/7-Reasons-Why-Not-Making-Mistakes-Is-The-Biggest-Mistake-9Wbscy.html 7 Reasons Why Not Making Mistakes Is The Biggest Mistake]]
[[http://goodvillenews.com/wk.html GoodvilleNews.com - good, positive news, inspirational stories, articles]]

Revision as of 20:31, 27 July 2012

Author: Zinthose (talk, contrib)


About

Macro to check for existence of file at compile time.

Example

    ${!IfNExist} "${__FILE__}"
        !error "File is Missing!  How is that possible!"
    !else
        !echo "File Exists!"
        InitPluginsDir
        SetOutPath $PLUGINSDIR\SourceCode
        file "${__FILE__}"
    !endif
 
    ${!IfExist} "Config\Special.ini"
        !warning "Using Config data from external file."
        ## TODO Inport Config Data
    !else
        !warning "Using Config data from source file."
        ## TODO Add Config Data
    !endif

Macro

/* ${!IfExist}
----------------------------------------------------------------------
    ${!IfExist} "C:\SomeFile.txt"
        !Error "File Exists!"
    !else
        !Error "File is Missing!"
    !endif */
    !define !IfExist `!insertmacro _!IfExist ""`
 
/* ${!IfNExist}
----------------------------------------------------------------------
    ${!IfNExist} "C:\SomeFile.txt"
        !Error "File is Missing!"
    !else
        !Error "File Exists!"
    !endif */
 
    !define !IfNExist `!insertmacro _!IfExist "n"`
    !macro _!IfExist _OP _FilePath
        !ifdef !IfExistIsTrue
            !undef !IfExistIsTrue
        !endif
        !tempfile "!IfExistTmp"
        !system `IF EXIST "${_FilePath}" Echo !define "!IfExistIsTrue" > "${!IfExistTmp}"`
        !include /NONFATAL "${!IfExistTmp}"
        !delfile /NONFATAL "${!IfExistTmp}"
        !undef !IfExistTmp
        !if${_OP}def !IfExistIsTrue
    !macroend