Prefer $TMPDIR to /data/local/tmp on Android
Newer devices can have the latter location read-only. (I observed this with Termux on a non-rooted Pixel 6.)
This commit is contained in:
		
				
					committed by
					
						
						Tanzinul Islam
					
				
			
			
				
	
			
			
			
						parent
						
							f42da0e443
						
					
				
				
					commit
					14d05f4708
				
			@@ -1064,6 +1064,12 @@ class CapturedStream {
 | 
			
		||||
    // The location /data/local/tmp is directly accessible from native code.
 | 
			
		||||
    // '/sdcard' and other variants cannot be relied on, as they are not
 | 
			
		||||
    // guaranteed to be mounted, or may have a delay in mounting.
 | 
			
		||||
    //
 | 
			
		||||
    // However, prefer using the TMPDIR environment variable if set, as newer
 | 
			
		||||
    // devices may have /data/local/tmp read-only.
 | 
			
		||||
    if (auto tmpdir = ::getenv("TMPDIR"))
 | 
			
		||||
      name_template.assign(tmpdir) += '/';
 | 
			
		||||
    else
 | 
			
		||||
      name_template = "/data/local/tmp/";
 | 
			
		||||
#elif defined(GTEST_OS_IOS)
 | 
			
		||||
    char user_temp_dir[PATH_MAX + 1];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user