Allan Odgaard
068855b4e0
Disable deprecation warning for API working on resource forks
...
There doesn’t seem to be any replacement API for this so while the warning (when building with the 10.8 SDK) may serve as a reminder to update the code, the only possible update I can see is to drop support for reading text clippings.
2015-08-05 12:32:06 +02:00
Allan Odgaard
c75b89c048
Avoid temporary CFStringRef when creating file system CFURLRef
2015-08-05 12:29:24 +02:00
Allan Odgaard
82e5e14ae1
Remove unused function: is_trashed
...
The intent was to use this to decide if the proxy icon should be hidden but the API used by the function is deprecated on 10.8.
2015-08-05 12:26:17 +02:00
Allan Odgaard
b3478a2628
Use “modern” API to examine and resolve alias files
2015-08-05 12:23:35 +02:00
Allan Odgaard
34b374c185
Avoid two uses of FSRef (which is deprecated from 10.8)
2015-08-05 12:23:29 +02:00
Allan Odgaard
0b70563c73
Add crash log info to track down a bug
...
Crash is in CFStringGetLength called from _CFURLCreateWithFileSystemPath, so it appears that some sort of malformed string can find its way to this call.
2015-08-05 12:22:50 +02:00
Allan Odgaard
457969788e
Use std::tuple for the OS version
...
This makes compatibility checks simpler, since we can use a single comparison operator.
2015-06-23 22:46:58 +02:00
Allan Odgaard
09dfe50051
Avoid taking the address of compound literals
...
Clang considers this to be an error, previously we disabled diagnostics for this case, but probably better to adapt our code.
2014-11-30 09:12:07 +07:00
Allan Odgaard
f34a8f28e0
Use CFURL API for getting and setting label color
2014-11-30 05:59:35 +07:00
Allan Odgaard
5b39bdc98b
Remove double semi-colons at end of line
2014-11-14 10:21:34 +01:00
Allan Odgaard
a778f0b3da
Combine std::set’s find and insert into a single operation
2014-11-10 17:11:31 +01:00
Allan Odgaard
be0804353c
Remove path::trash API (unused)
...
This is based on FSRef which is deprecated starting with 10.8 so if we later need it then we likely would have to reimplement it.
2014-11-04 13:51:32 +01:00
Allan Odgaard
d59029b70c
File flags were lost when saving to a non-local file system
...
This broke in 9b3dd8c .
2014-10-20 16:01:07 +02:00
Allan Odgaard
9b3dd8c0f4
Don’t use COPYFILE_METADATA with files on network drives
...
According to a user report this is causing TextMate to freeze. Reported to Apple as <rdar://17480649>.
2014-09-01 17:37:10 +02:00
Allan Odgaard
8782e2aa81
Fix bug with PATH variable containing trailing zero byte
2014-05-18 23:14:07 +07:00
Allan Odgaard
af3f4aaa33
Check result of most CF/CT ‘Create’ functions
2014-05-15 13:17:30 +07:00
Allan Odgaard
b8804d1164
Fix three memory leaks
...
One was per launch, one was per key event, and one was per (unique) line drawn.
2014-05-15 13:17:29 +07:00
Allan Odgaard
1f0e3db472
Remove trailing zeroes from numeric literals
...
I mainly dislike the trailing zeroes because CGFloat used to be a float but 1.0 is a double (1.0f would be a float). So better to under-specify and let the compiler figure out the proper type.
2014-04-14 14:26:52 +07:00
Allan Odgaard
39b94e6ac3
Harmonize whitespace and add trailing newline
2014-04-14 14:26:52 +07:00
Allan Odgaard
db13d4c1f9
Use std::string::back() instead of operator[] with size()-1
2014-03-31 08:27:18 +07:00
Allan Odgaard
716b8ea8f3
Add path::unescape to split a shell line into words
2014-03-29 18:58:53 +07:00
Allan Odgaard
c73ad254cb
Add path::escape to use when passing paths to a shell interpreter
2014-03-29 18:58:53 +07:00
Allan Odgaard
c3120c15aa
Set FD_CLOEXEC immediately after calling mkstemp()
...
There is still a race condition but it’s a little better than before.
2014-03-29 09:57:10 +07:00
Allan Odgaard
fe59a55750
Do not abort() if we fail to create a pipe
...
Failure to create a pipe does happen “in the wild” (with the error “too many open files”). Since majority of subprocess executions relate to gathering version control info we can probably ignore the failure, as not having version control info is better than crashing.
OTOH that pipe() fails does seem to be a symptom of a more serious issue.
The io::spawn implementation has also been updated to use io::create_pipe which sets FD_CLOEXEC, so there should be no reason to set this.
2014-03-29 09:57:10 +07:00
Allan Odgaard
7f7613fe62
Change io::create_pipe API
...
We now return a tuple and always set FD_CLOEXEC.
2014-03-29 09:57:09 +07:00
Allan Odgaard
dac27f7587
Use constants for input, output, and error file descriptors
2014-03-29 09:57:09 +07:00
Allan Odgaard
5881b86775
Support initial content when creating temporary files
2014-03-28 19:31:15 +07:00
Allan Odgaard
cf8f796053
Do not use va_start macro with variable reference
...
This is undefined according to the standard and is a warning with clang-503.0.38.
2014-03-13 20:51:15 +07:00
Allan Odgaard
c2397484b8
Use C++11 for loop
...
Majority of the edits done using the following ruby script:
def update_loops(src)
dst, cnt = '', 0
block_indent, variable = nil, nil
src.each_line do |line|
if block_indent
if line =~ /^#{block_indent}([{}\t])|^\t*$/
block_indent = nil if $1 == '}'
line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
$1.to_s + variable + ($2 == "->" ? "." : "")
end
else
block_indent = nil
end
elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
block_indent, variable = $1, $2
line = "#$1for(auto const& #$2 : #$3\n"
cnt += 1
end
dst << line
end
return dst, cnt
end
paths.each do |path|
src = IO.read(path)
cnt = 1
while cnt != 0
src, cnt = update_loops(src)
STDERR << "#{path}: #{cnt}\n"
end
File.open(path, "w") { |io| io << src }
end
2014-03-03 10:34:13 +07:00
Allan Odgaard
1f57336da8
Log error when mkdir() fails
2013-12-14 14:22:15 +07:00
Allan Odgaard
20583653f9
Test if io::spawn fails
2013-10-19 21:21:33 +02:00
Allan Odgaard
c602958e66
Don’t stack allocate space for extended attribute values
...
Seeing a few crashes related to this, most likely because an extended attribute holds a value larger than available stack space.
2013-10-04 16:51:27 +02:00
Allan Odgaard
c5558d0574
Remove a few std::shared_ptr typedefs
2013-10-04 16:51:26 +02:00
Allan Odgaard
d3a78e59f2
Put posix_spawn related failure in crash report
2013-09-05 23:57:03 +02:00
Allan Odgaard
1c308c810d
Use map::emplace instead of inserting std::pair (C++11)
2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c
Use std::make_shared
2013-09-03 12:27:20 +02:00
Allan Odgaard
7e6d0b8d1b
fixup! Log errors from each call in swap_and_unlink
2013-08-25 21:13:06 +02:00
Allan Odgaard
6889ba9ba7
Log errors from each call in swap_and_unlink
2013-08-23 23:21:16 +02:00
Allan Odgaard
802ea1fc7a
Treat most errors from exchangedata() as “not supported”
...
It seems to be a general trend with network file systems to return wrong errors when they do not support a certain feature (like extended attributes and atomic swap).
2013-08-21 22:20:43 +02:00
Allan Odgaard
9eda1a473b
Remove path::identifier_t
2013-07-30 15:44:18 +02:00
Allan Odgaard
0a64d372a9
Improve lstat error message
2013-07-29 16:07:33 +02:00
Allan Odgaard
7ed6199df1
Print error if scandir/lstat fails
2013-07-26 16:26:20 +02:00
Allan Odgaard
115838949a
Do not resolve broken symbolic links
...
Links that would point “above” the root (e.g. ‘/foo’ → ‘../../bar’) would cause an infinite recursion and eventually crash.
2013-07-02 18:43:46 +02:00
Allan Odgaard
ef6082006d
Failing to set/remove extended attributes is no longer an error
...
Workaround for osxfuse/osxfuse#85 (and possibly other file systems).
2013-05-26 10:24:35 +08:00
Allan Odgaard
7f88fcbdf3
Fix problem with opening multiple empty files on FAT file systems
...
The problem is that empty files on a FAT file system all have the same inode so TextMate would consider them to be links of each other and only show the last one opened.
Fixes #979 .
2013-05-15 16:17:06 +07:00
Allan Odgaard
58dc0b0491
Remove path::walker_t
...
The intent of this class was to allow ad-hoc recursive/lazy walking of a directory structure and having links only visited once.
It was however only used once, and for that task, path::entries() is sufficient.
2013-05-15 15:45:36 +07:00
Allan Odgaard
bf7d657eef
Move some TM variables to oak::basic_environment
2013-05-12 11:09:18 +07:00
Allan Odgaard
ec9208afa9
Use whitelist feature to preserve dialog variables
2013-05-12 11:09:18 +07:00
Allan Odgaard
950cb8b27a
Only lock mutex for critical code
2013-03-25 10:25:59 +01:00
Allan Odgaard
8ce1c48fe7
Introduce io::spawn API
...
This is a wrapper for posix_spawn that sets up pipes for stdin, out, and error.
2013-03-21 14:39:34 +01:00