How to Make Sure a File is Never Replaced?

Discussion in 'macOS' started by thriii, Nov 22, 2009.

  1. thriii macrumors 6502

    Joined:
    Feb 14, 2007
    #1
    Hopefully there is an answer to this..

    I replaced a file inside of the contents of an application and I was wondering if there is a way I could lock the file or somethin so it never gets replaced.. is this possible in any way? if not.. what else can I do to make sure the file works after updates?
     
  2. dukebound85 macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #2
    why o why do i feel this is dealing with piracy?

    call me a skeptic

    what exactly are you worried about replacing op?
     
  3. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #3
    I'm not following why someone would want to do this, unless they're installing malware of some sort.
     
  4. Bennieboy© macrumors 65816

    Bennieboy©

    Joined:
    Jan 15, 2009
    Location:
    england
    #4
    you could just buy the software, or being very very careful, ( no i am not condoning software piracy ;) )
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Depends on what you mean by "never." From Finder, select file > Get Info > checkbox for Locked. That should be a reasonable effect. Admin will always be able to replace if desired, there's no getting around that.
     
  6. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #6
    You are really not giving details, and all the important information is in the details. But you might want to take a look at the man page for 'chflags'. There are both the 'uchange' and the 'schange' flags that might do what you want to do.
     
  7. thriii thread starter macrumors 6502

    Joined:
    Feb 14, 2007
    #7
    i laughed at the replies :p this doesnt have to deal with piracy at all.. I have 1Password and if you have it you know that it places an Icon which is usually "1P" in your browser bar by the back/forward buttons. it does this by putting a file in the firefox applications folder telling it to get the button image from inside the 1Password contents folder.. So I modded the Icon so it matches my firefox theme (just gotta figure out how to move the button down!)
    [​IMG]

    I just dont want the png file for the button to be replaced if I upgrade 1password

    So as you can see! no piracy! :)
     
  8. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #8
    I suppose you can change the permissions to the file to read only, and that may "protect" it.
     
  9. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #9
    The lock suggestion I gave may help, but something you want to think about is that if the updater cannot copy in a new file it could cause an error and break 1Password.
     
  10. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #10
    As you can see from this thread, it helps if you fully describe what your problem is and what you're trying to accomplish. That way, you'll get more useful replies.
     
  11. TonyK macrumors 6502a

    TonyK

    Joined:
    May 24, 2009
    #11
    There is one reason why someone may change a file in a package. 1Password does not support Camino 2 at this time. Thus we have to change a plist file for supported browsers. This is an official "hack" for 1Password to get Camino 2 to work. Nothing illegal about it. And it would be annoying to have to replace that change should 1Password do an update and over-write that file.

    If a file is part of a package (single file application), I'm not sure you can prevent it from being replaced. The best bet is to create a folder mimicking the structure of the package and put a copy of the edited file there so it can be easily replaced as needed.
     
  12. ss957916 macrumors 6502a

    Joined:
    Jun 17, 2009
    #12
    As you can see from this thread, it helps if you don't jump to conclusions and just give people the benefit of the doubt. That way you don't waste your time falsely accusing people.
     
  13. MikeDTyke macrumors 6502a

    Joined:
    Sep 7, 2005
    Location:
    London
    #13
    sudo chflags schg name_of_file.png

    Is the daddy of file locking. Set this and not even root can remove the file. It is system immutable...

    If you do want to remove afterward, boot your mac into single user mode with command+s. cd to the relevant directory and enter:

    chflags noschg name_of_file.png

    No one can say if a 1Password update will fail if it tries to update the file. A case of try and see, and if it does you can unset the flag and make a backup copy of the image. to re-apply after.

    Job as they say is a good un. :)
     
  14. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #14
    I didn't jump to any conclusions. Nor did I make any assumptions about or accuse anyone of anything. Reading comprehension is a good thing! You should try it!
     

Share This Page