Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Store temp files in /tmp/vimclip/ (Close #5) #8

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

cjbassi
Copy link
Contributor

@cjbassi cjbassi commented Jan 29, 2019

This works on Linux, but I'm not sure about OSX since I don't have a mac to test on and the mktemp documentation I found online didn't provide much info.

@cjbassi cjbassi changed the title Store temp files in /tmp/vimclip/ (Close #5) (WIP) Store temp files in /tmp/vimclip/ (Close #5) Jan 29, 2019
@hrantzsch
Copy link
Owner

I like the idea of causing less clutter. I think we need to value $TMPDIR though, if it is set.
Oh, and I'll try to test it on MacOS tomorrow.

vimclip Outdated
@@ -11,7 +11,8 @@ if [ "Darwin" = $(uname -s) ]; then
exit 1
fi

TMP=$(mktemp -t vimclip)
mkdir -p /tmp/vimclip
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the mac machine I tested, $TMPDIR is not /tmp. So this doesn't work.

mkdir -p $TMPDIR/vimclip
mktemp -t vimclip/vimclip

should work, but I don't know if we can assert $TMPDIR to be set. Probably we need to check it first and default to /tmp if it isn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a check for $TMPDIR and defaulted to /tmp if it's unset. Let me know if it works for you now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks. Looks like it should work -- I'll be able to test on MacOS tomorrow again. Could you do the same check for $TMPDIR on Linux?

@hrantzsch
Copy link
Owner

Bad news. I tested again on MacOS and it turns out that before evaluating TMPDIR it claims to look at _CS_DARWIN_USER_TEMP_DIR in the man page of mktemp. However, I wasn't able to make it use another directory by setting either _CS_DARWIN_USER_TEMP_DIR nor TMPDIR. Instead, mktemp seems to get the place where it creates the temp-file from getconf DARWIN_USER_TEMP_DIR.
This is all getting very complicated and I'm not sure if it makes sense to complicate the simple script that much. How about we simply don't have a subfolder on MacOS?

@cjbassi
Copy link
Contributor Author

cjbassi commented Feb 5, 2019

Yah that's sounds pretty messy. So I did some quick searching and it seems like $TMPDIR is automatically set, probably by the configuration option you mentioned. So even though configuring the tempdir location can be difficult, it sounds like $TMPDIR should point to the right tempdir folder, in which case it should be fine to use I think. At least that's what it sounded like base on this.

edit: I don't have a mac tho, so let me know if any of that seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants