windows - Where should I create a PID/lock file when writing a portable application -


i modifying application have written prevent multiple instances running @ same time.

my first thought, (according the linux fhs) store pid file in /var/run. in way, can check if pid file exists, , exit error if does.

now, if want app portable, have consider /var/run not exist on every system (f.ex. windows).

what best practice in case?

note: not have pid file. 0-byte "lock" file trick well. pid file have advantage of providing pid whomever need investigate problems.

clarification: application backup script run defined user.

one of way make application rely on porting framework (like qt). such framework provides abstraction of platform, allowing put @ "correct place" (e.g. windows, changes between xp, vista/7). might example have @ qsettings if can't rely on framework, digging code might provide advanced answer.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -