openframeworks / openframeworks/openFrameworks

ofFilePath::getCurrentWorkingDirectory() doesn't change on OSX

Open
#3,778 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug core macOS section-internals
Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

So getCurrentWorkingDirectory() always returns the executable dir on OS X: https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/utils/ofFileUtils.cpp#L1637

This is actually not very useful since:

  1. it doesn't actually return the current working directory ie. chdir() does't effect it
  2. there is already an ofFilePath::getCurrentExeDir()

I mainly noticed this since I have an app where I need to change the current working directory and couldn't figure out why it "wasn't" working. Later on I noticed this implementation and switched to getcwd() which confirmed that chdir() was working fine.

I propose removing the defined OS X specific code here.

(EDIT: Also, why is it "getCurrentWorkingDirectory()" and "getCurrentExeDir()"? Shouldn't that be "getCurrentExeDirectory()"?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libs/openFrameworks/utils/ofFileUtils.cpp at the linked getCurrentWorkingDirectory() implementation, then compare it with getCurrentExeDir(). Verify the behavior of chdir() and getcwd() on OS X. Done means the working-directory function reflects the process working directory and the requested naming concern is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.